SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Dynamic Field value problem in SSRS
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

the_justin
Starting Member

19 Posts

Posted - 09/24/2012 :  03:56:42  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 09/24/2012 :  13:36:15  Show Profile  Reply with Quote
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 - 09/25/2012 :  00:52:15  Show Profile  Reply with Quote
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

India
52317 Posts

Posted - 09/25/2012 :  12:53:31  Show Profile  Reply with Quote
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 - 09/26/2012 :  00:12:32  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000