Thursday, September 29, 2016

Show all records/some records based on parameter value

Method 1 
You need to set up a filter similar to the following:
enter image description here
Where the expression is:
=IIf(Parameters!FilterColumn.Value = Fields!Category.Value
        or Parameters!FilterColumn.Value = "All products"
    , "Include"
    , "Exclude")
This matches the row Category based on the parameter value, or, if the value = All products, will include all rows.
As mentioned in the comments and the other answer, this is possible in the SP too, but since it seems to be specifically to demonstrate the functionality this should do the trick at the report level.
--------------------------------------------------------------------------------------------------------------------------
Method 2 
I have created some solution and worked for me:
enter image description here
In Expression field, I put first expression:
1.  Iif(Parameters!FilterColumn.Value = "All", 1, Fields!Category.Value)
In Value field, I put second expression:
2.  Iif(Parameters!FilterColumn.Value = "All", 1, Parameters!FilterColumn.Value)
So, when I choose "All" value in parameter, then first expression will result 1, and second expression will result 1, and i have 1 = 1 which is true for all rows, and I got all rows in table.
When I choose specific category from parameter, then in first expression result will be Fields!Category.Value and in second expression will be Parameters!FilterColumn.Value. Simple, I got Fields!Category.Value = Parameters!FilterColumn.Value, or just give me rows where category is that choosen in parameter.
source : http://stackoverflow.com/questions/18203317/show-all-records-some-records-based-on-parameter-value



No comments:

Post a Comment