简体   繁体   English

根据可见性表达式SSRS 2008隐藏表格或分配临时数据

[英]Hiding table or assigning temp data based on visibility expression ssrs 2008

I have a table in ssrs 2008. This table has a row visibility expression like: 我在ssrs 2008中有一个表。该表具有行可见性表达式,例如:

=IIF(max(Fields!VExpected.Value) <> "", 1, 0) + 
 IIF(max(Fields!MExpected.Value) <> "", 1, 0) + 
 IIF(max(Fields!PExpected.Value) <> "", 1, 0) = 3, false, true)

Sometimes the datasource returns no data, or the returned data is not matching with this expression. 有时,数据源不返回任何数据,或者返回的数据与此表达式不匹配。 In this case what I see is that a table with borders and column names but no data on it like: 在这种情况下,我看到的是一个带有边框和列名但没有数据的表,例如:

id Vex Mex Pex

However, I want to show it as 但是,我想显示为

id Vex Mex Pex
-  -   -   -

Or if possible: 或者,如果可能的话:

id Vex Mex Pex
No Data

Another question is, is there any way to hide the complete table if there is no returning data or any matching data with the expression? 另一个问题是,如果表达式没有返回数据或任何匹配数据,是否可以隐藏整个表?

Thanks 谢谢

You can use CountRows function to determine how many rows your dataset is returning. 您可以使用CountRows函数来确定数据集将返回多少行。 If it is zero hide the table otherwise show it. 如果为零,则隐藏表,否则显示该表。

=iif(CountRows("DataSetName")=0,true,false)

Replace DataSetName by the actual name of your dataset. 用数据集的实际名称替换DataSetName

For not matching expression data you can use the this expression. 对于不匹配的表达式数据,可以使用this表达式。

=IIF(
max(Fields!VExpected.Value) <> "" AND
max(Fields!MExpected.Value) <> "" AND
max(Fields!PExpected.Value) <> "",False,True
)

The whole expression for matching expression and no rows cases could be something like this: 用于匹配表达式的整个表达式,没有行的情况可能是这样的:

=Switch(
CountRows("DataSetName")=0,true,
max(Fields!VExpected.Value) = "",true,
max(Fields!MExpected.Value) = "",true,
max(Fields!PExpected.Value) = "",True,
true,False
)

Supposing VM, ME and PE expected values are numeric type I'd use ISNOTHING() function to determine when null values are being returned. 假设VM,ME和PE的期望值是数字类型,我将使用ISNOTHING()函数来确定何时返回空值。

=Switch(
CountRows("DataSetName")=0,true,
ISNOTHING(max(Fields!VExpected.Value)),true,
ISNOTHING(max(Fields!MExpected.Value)),true,
ISNOTHING(max(Fields!PExpected.Value)),True,
true,False
)

Additional you can set a message when no rows are being returned from your dataset. 另外,当您的数据集未返回任何行时,您可以设置一条消息。 Select the tablix and press F4 to see properties window. 选择Tablix,然后按F4查看属性窗口。 Go to NoRowsMessage property and use an expression to say your users there is no data. 转到NoRowsMessage属性,并使用表达式表示您的用户没有数据。

="There is no data."

In this cases the tablix will not appear in your report but the message you set will be rendered in the location where the tablix should be. 在这种情况下,tablix将不会出现在您的报告中,但是您设置的消息将显示在tablix应该放置的位置。

Let me know if this helps. 让我知道是否有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM