Hide field in report depending on sub string value

时间:2016-10-19 13:34:14

标签: reporting-services ssrs-2012

I have parameter in my stored procedure @Selection nvarchar that can hold string values. So I will pass in that parameter something like 'Today,yesterday,last week'. In the stored procedure, I make sub strings from that parameter and put them into a temp table and make same field hiding. And it works.

But I don't know how to hide fields in ssrs on the same way like in stored procedure. I will put value in that parameter and for example I will want to hide/show some field based on that value.

So if I have value 'Today,yesterday,last week', I would like to hide 3 fields, first one will depends on today value, second on yesterday and last one on last week.

1 个答案:

答案 0 :(得分:0)

您可以根据参数值设置列可见性。要设置列可见性,请右键单击列句柄并选择“列可见性”。 enter image description here

表达式的值应该是这样的:

=IIf(InStr(Parameters!Days, "yesterday") > 0, True, False)

Parameters!Days是您的参数,而yesterday是您希望动态隐藏的每列的适当密钥。

另外,如果你没有在你的SQL代码中选择这个列(即一个案例返回的列可能是(昨天,今天),而另一个(今天,总计))你可以使用数据集的内置功能来确定从SQL Server发送的数据中是否缺少列。可见性的表达式将是:

=Fields!SomeColumn.IsMissing