RDLC 表达式计算值为 True 的所有行

RDLC Expression counting all rows where value is True

我需要计算所有 "True" 的值,但我有 2 个数据集。我看过很多关于一个数据集的教程,这看起来很简单,因为他们只需命名值就可以了。 我试过的是这个

=Count(IIf((Fields!Usvojena.Value, "DataSetTackeDnevnogReda") = "True", 1, Nothing))

我收到此错误消息:

The Value expression for the textrun ‘Textbox8.Paragraphs[0].TextRuns[0]’ has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a dataset.

另外由于某些原因 Fields!Usvojena.Value 在我的表达式 windows

中总是带有红色下划线

您可以使用 SUM 而不是计数来消除包括 "Nothing" 的值(并且无论如何都要得到您的计数)- 只为具有字段的那些添加一个!Usvojena.Value = true,如果是则为零不是。另外,如果字段是布尔值True/False,那么你可以这样做:

=Sum(IIf(Fields!Usvojena.Value, 1, 0))

如果该字段只是一个具有 "True" 或 "False" 值的字符串,那么您需要将此值添加到比较中:

=Sum(IIf(Fields!Usvojena.Value = "True", 1, 0))

至于红色底层 - 还要检查字段名称。