简体   繁体   English

使用SSRS表达式隐藏子报表无法按预期工作

[英]hide subreport using SSRS expression is not working as expected

I have a 我有一个 主要报告 called Report 1 and a sub report. 称为报告1和子报告。 子报告 is embedded in one of the rows in the main report. 嵌入在主报表的某一行中。 I am trying to hide the sub report from showing Milestone_ID value as null. 我试图隐藏子报告,以免将Milestone_ID值显示为空。 I used the expression on the visibility property of the table I used on sub report. 我在子报表上使用的表的可见性属性上使用了表达式。

I am using =iif(not IsNothing(Fields!Milestone_ID.Value),false,true) expression 我正在使用=iif(not IsNothing(Fields!Milestone_ID.Value),false,true)表达式

The problem is, 问题是, 当我第一次预览报告时,它工作正常 . The heading of the sub report is hidden but when I go back and forth and come back to the same report in report viewer 子报表的标题是隐藏的,但是当我在报表查看器中来回切换到同一报表时 它不起作用。

I've not seen this behavior before but normally when I want to show/hide a subreport, I calculate the visibility in the main dataset and then simply set the visibility of the subreport object or table row in the MAIN report. 我以前从未见过这种现象,但是通常情况下,当我想显示/隐藏子报表时,我会在主数据集中计算可见性,然后在MAIN报表中简单地设置子报表对象或表行的可见性。 In other words, I don't change anything in the actual subreport design. 换句话说,我不会在实际的子报表设计中进行任何更改。

I changed the expression I sued to =CountRows() = 0 on the visibility property of the table on the sub report. 我将子报表上表的可见性属性更改为= CountRows()= 0。 Now It is working as expected. 现在它正在按预期工作。 when the sub report is embedded under the main report the expression was not finding the field MilestoneId which I set in the expression. 当子报表嵌入在主报表下时,表达式找不到我在表达式中设置的MilestoneId字段。

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

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