Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Dynamic Field value problem in SSRS

Author  Topic 

the_justin
Starting Member

19 Posts

Posted - 2012-09-24 : 03:56:42
Hi All,
Anyone has any idea how I can achieve this:

Dynamically changing calculation formula if parameter is changed.

so let's say I have table formula:

select '(Fields!A.Value + Fields!B.Value)/Fields!C.Value' as formula, 'A' as keycol union
select 'Fields!A.Value/Fields!C.Value' as formula, 'B' as keycol


and i have a value table:
select 1 as A, 2 as B, 3 as C


now, i then have a parameter which consist of 2 values (A and B).
if user selects A, it will use formula A from table formula, and obviously it will use B if user selects parameter B.

Is there anyway I can dynamically generate or update the xml to change the value of my table to show the correct formula?

Hopefully my question make sense.

Thank you

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-24 : 13:36:15
why do you need to pass string from sql?

why cant you build same logic inside SSRS expression using IIF() or Switch()?

ex?

Switch(Parameters!yourParam.value = "A",(Fields!A.Value + Fields!B.Value)/Fields!C.Value,
Parameters!yourParam.value = "B",Fields!A.Value/Fields!C.Value,
...)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

the_justin
Starting Member

19 Posts

Posted - 2012-09-25 : 00:52:15
Hi visakh16,
Thank you for your reply.
What I'm trying to avoid is having to modify the rdl everytime there's a new new formula. Because the formulas will potentially be modified and added every now and then.

Thank you
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-25 : 12:53:31
hmm..there are ssrs expressions. cant understand why one will need to change it from outside

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

the_justin
Starting Member

19 Posts

Posted - 2012-09-26 : 00:12:32
Hi visakh16,
What i mean is at this time, we only have 2 formula, (A+B)/C and A/C. But maybe in a month time, there'll be a new formula, A-C and (A+B)/C will be modified to (A-C)/B.
If I use the switch or iif statement, I'll need to modify the rdl for every changes. This is what I'm trying to avoid.

Thank you
Go to Top of Page
   

- Advertisement -