Hide subreport on query result

≡放荡痞女 提交于 2019-12-12 02:54:58

问题


I'm developing an SSRS report containing several sub-reports. The report gets a parameter and uses it to query an object ID which is used as parameter for all sub-reports. The problem ist that in some cases the query returns no object ID (dataset has no data records). In this case I have to hide the sub-reports and show a text message.

I don't know how to set the Show/Hide condition for the sub-reports. I could use a variable for that but I don't know how to set the variable value based on the query result.


回答1:


As Jeroen writes, the Visibility value of the SubReport should be set as follows:

=IIF(RowNumber("MyDataSet") = 0, True, False)




回答2:


On your subreport you can add a Textbox which has text the you'd want to show when no data is returned. The visibility or the hidden property of the textbox should be set as

=iif(Count(Fields!SomeField.Value, "DataSet") > 0, true, false)

Similarly for the subreport put it in a Rectangle and set the visibility or the hidden property as

=iif(Count(Fields!SomeField.Value, "DataSet") > 0, false, true)


来源:https://stackoverflow.com/questions/14769294/hide-subreport-on-query-result

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!