Search code examples
reporting-servicesssrs-2008

Row visilbility based on two parameters


I'm trying to make a row visible based on two parameters.

  • ParameterA is a string.
  • ParameterB is a string.

Dataset looks like this:

Product | Warehouse  |  Quantity

1000     |     A      |    100
1000     |     B      |    100
Subtotal |            |    200
1001     |     A      |    200
1001     |     B      |    200
Subtotal |            |    400
1002     |     A      |    500
Subtotal |            |    500

Parameter A shows (2) or hides (1) the individual warehouse entries, just leaving the subtotal.

For Parameter B, it returns a 0 if there is only one warehouse with stock for a product, and a 1 if there is more than one warehouse with stock for that product.

For the 'subtotal rows', I would like it to show if Parameter A wants to hide the warehouse entries, but obviously make sure the row is visible if there is only one product for that warehouse. Otherwise, Product 1002 won't show with the 'hide individual warehouse entries' option.

My attempt looks like this:

=IIF(Parameters!ParameterA.Value = "2" & Parameters!ParameterB.Value = 1,True,False)

This generates the below error:

The Hidden expression for the tablix 'Tablix2' contains an error: operation '&' is not defined for string "2" and type 'Object()'.

Any ideas how to get the desired result would be appreciated.


Solution

  • In VB.Net, '&' is used for concatinating two strings and for logical-AND operator we simply use 'and'.. These are two entirely different keywords.

    Here, you are trying to use '&' for logical-And operation which causes the error. Correct expression should be like this:

        =IIF(Parameters!ParameterA.Value = "2" AND Parameters!ParameterB.Value = 1,True,False)