Trying to setup a custom parameter (to work as a flag) in SSRS
Hi, Thanks for looking into this thread. I have a SSRS report which displays results for two regions say A and B. Now, I want to set up a flag (0 for A and 1 for B), providing users an option to select either A or B or Both from SSRS parameter. Behind the scene, I have a stored procedure which excepts A and executes query from a view related to A (I have different views for A and B). Similarly, on selecting B, query gets executed for view B. Now, for 0 and 1 individually, it works fine calling respective views / queries but I need to set default as both (saying - 'A / B' in parameter). I know the use of SP with a Split function but as I am trying to acheive this with a flag and SP having individual queries. How to achieve this functionality in SSRS? Thanks for your help !
March 29th, 2012 3:19am

Hi Do you have 2 parameters or 1? and are you trying to combine them into one parameter with the options of selecting region A , B or both regions. I think you need to provide some more information so users can understand what you are tring to achieve.
Free Windows Admin Tool Kit Click here and download it now
April 2nd, 2012 10:20am

Hi Niraj, For a multi-value parameter in Reporting Services, the expression =Parameters!<MultivalueParameterName>.Value(0) returns the first value of the parameter and the expression =Parameters!<MultivalueParameterName>.Value(Parameters!<MultivalueParameterName>.Count-1) returns the last value of the parameter. In this issue, if the two data regions use the same dataset, we can add a filter to each tablix. I assume that the parameter name is Region, please refer to the filters below: Filter for tablix A: Expression: [Category] Operator: = Value: =IIF(Parameters!Region.Value(0)=0, Fields!Category.Value, Nothing) Filter for tablix B: Expression: [Country] Operator: = Value: =IIF(Parameters!Region.Value(Parameters!Region.Count-1)=1, Fields!Country.Value, Nothing) If the tablix A and B use different datasets, taking the report performance into account, I suggest that you create two parameters for the two datasets. Please refer to the steps below (I assume that tablix A uses dataset1 and tablix B uses dataset2): In the dataset1, create the query parameter @Region1 by adding the following WHERE clauses to the query: WHERE (@Region1=1)Open the Parameter Properties dialog of Region1, and set the parameter visibility to Hidden.In the Available Values tab, specify the following value for the parameter: Label: Region1 Value: =IIF(Parameters!Region.Value(0)=0,1,0)In the Default Values tab, specify the following value: =IIF(Parameters!Region.Value(0)=0,1,0)Repeat the above steps to create @Region2 parameter for dataset2, and then use the following expression to specify value for @Region2: =IIF(Parameters!Region.Value(Parameters!Region.Count-1)=1,1,0) Reference: Using Parameters Collection References in Expressions If you have any questions, please feel free to let me know. Regards, Mike Yin
April 3rd, 2012 12:28am

Hi Mike, I have a similar question: I have 2 filter parameters for a SSRS report. However, I want to let the user specify either of the value for report generation. For Instance, for a report for sales, I have 2 filter parameters, Region and Product. I want the user to either select Region filter or Product filter or both filters. I am not able to find a way to do it. Appreciate your help. Thanks, Ritika
Free Windows Admin Tool Kit Click here and download it now
September 18th, 2012 7:22pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics