SSRS 将总行数从主报表传递到子报表

SSRS Pass Total Number of Rows from Master to Subreport

我有一个 SSRS 报表,其中包含一个带 table 的母版页,它将行数据从 table 传递到子报表。

我还想将 table 中包含的总行数传递给子报表。

我尝试使用以下两种方法在母版页上设置一个变量:

=CountRows("Assessment") 

=Max(Fields!ROWNUM.Value, "Assessment")

但是当我尝试将变量传递给子报表时出现错误:

Error       [rsCyclicExpressionInReportVariable] The Variable(TOTAL_ROWS) expression for the report contains a direct or indirect reference to itself.  Loops in variable value expressions are not allowed.

如果我尝试将这些表达式中的任何一个直接放入子报表的参数表达式中(子报表属性 -> 参数,然后是 fx),我得到错误:

Exception of type 'Microsoft.Reporting.Services.ReportProcessing+DataCacheUnavailableException' was thrown

知道如何获得传递给子报表的总行数吗?

所以路过

=Max(Fields!ROWNUM.Value, "Assessment")

因为参数的表达式确实有效,但如果您得到 'DataCacheUnavailableException' 您需要删除文件“MasterFileName”。rdl.data 以从根本上清除报告数据缓存。