简体   繁体   English

如何在此 SSRS 表达式中“指定数据集聚合”?

[英]How can I "specify a dataset aggregate" in this SSRS Expression?

I need a row value in my SSRS report that is a calculated one based on a couple of fields that are already being used in the report.我的 SSRS 报告中需要一个行值,该行值是根据报告中已使用的几个字段计算得出的。 I want it to display in the textbox named 'textboxPercentageValue'.我希望它显示在名为“textboxPercentageValue”的文本框中。 In semi-plain English, the expression/formula is:在半简单的英语中,表达式/公式是:

If the value of the "Week" field is "WK1", display the value of the Variance field divided by the value of the Price field; otherwise, just display the value from the Variance field.

In VB script gobbledygook, the expression/formula I've add to textboxPercentageValue's Value propert is:在 VB 脚本 gobbledygook 中,我添加到 textboxPercentageValue 的 Value 属性的表达式/公式是:

=IIF((Fields!Week.Value="WK1"), Fields!Variance.Value / Fields!Price.Value, Fields!Variance.Value)

Yet, when I try to upload the.rdl file to SQL Server Reporting Services, I get:然而,当我尝试将 .rdl 文件上传到 SQL Server Reporting Services 时,我得到:

" The Value expression for the text box 'textboxPercentageValue' refers directly to the field 'Week' without specifying a dataset aggregate. When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope. (rsFieldReferenceAmbiguous) Get Online HelpThe Value expression for the text box 'textboxPercentageValue' refers directly to the field 'Variance' without specifying a dataset aggregate. When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope. (rsFieldReferenceAmbiguous) Get Online Help The Value expression for the text box 'textboxPercentageValue' refers directly to the field 'Price' without specifying a dataset aggregate. When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope. (rs "文本框 'textboxPercentageValue' 的值表达式直接引用字段 'Week' 而不指定数据集聚合。当报表包含多个数据集时,数据区域外的字段引用必须包含在指定数据集范围的聚合函数中. (rsFieldReferenceAmbiguous) Get Online HelpThe Value expression for the text box 'textboxPercentageValue' refersed directly to the field 'Variance' without specified a dataset aggregate. 当报表包含多个数据集时,数据区域外的字段引用必须包含在聚合函数中指定数据集范围。(rsFieldReferenceAmbiguous) 获取联机帮助文本框“textboxPercentageValue”的值表达式直接引用字段“Price”而不指定数据集聚合。当报表包含多个数据集时,数据区域外的字段引用必须包含在指定数据集范围的聚合函数中。(rs FieldReferenceAmbiguous) Get Online Help The Value expression for the text box 'textboxPercentageValue' refers directly to the field 'Variance' without specifying a dataset aggregate. FieldReferenceAmbiguous) 获取联机帮助 文本框“textboxPercentageValue”的值表达式直接引用字段“Variance”,而不指定数据集聚合。 When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope.当报表包含多个数据集时,数据区域外的字段引用必须包含在指定数据集范围的聚合函数中。 (rsFieldReferenceAmbiguous) " (rsFieldReferenceAmbiguous)

So what do I need to do to make this expression/formula unambiguous to SQL Server Reporting Services or the VBScript parser or "whoever" is complaining about it?那么我需要做什么才能使这个表达式/公式对于 SQL Server Reporting Services 或 VBScript 解析器或“任何”抱怨它的人来说是明确的?

I need a row value in my SSRS report that is a calculated one based on a couple of fields that are already being used in the report.我在SSRS报表中需要一个行值,该值是根据报告中已使用的几个字段计算得出的。 I want it to display in the textbox named 'textboxPercentageValue'.我希望它显示在名为“ textboxPercentageValue”的文本框中。 In semi-plain English, the expression/formula is:在半普通英语中,表达式/公式为:

If the value of the "Week" field is "WK1", display the value of the Variance field divided by the value of the Price field; otherwise, just display the value from the Variance field.

In VB script gobbledygook, the expression/formula I've add to textboxPercentageValue's Value propert is:在VB脚本gobbledygook中,我添加到textboxPercentageValue的Value属性的表达式/公式是:

=IIF((Fields!Week.Value="WK1"), Fields!Variance.Value / Fields!Price.Value, Fields!Variance.Value)

Yet, when I try to upload the .rdl file to SQL Server Reporting Services, I get:但是,当我尝试将.rdl文件上载到SQL Server Reporting Services时,我得到:

" The Value expression for the text box 'textboxPercentageValue' refers directly to the field 'Week' without specifying a dataset aggregate. When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope. (rsFieldReferenceAmbiguous) Get Online HelpThe Value expression for the text box 'textboxPercentageValue' refers directly to the field 'Variance' without specifying a dataset aggregate. When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope. (rsFieldReferenceAmbiguous) Get Online Help The Value expression for the text box 'textboxPercentageValue' refers directly to the field 'Price' without specifying a dataset aggregate. When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope. (rs 文本框'textboxPercentageValue'的值表达式直接指向字段'Week',而未指定数据集聚合。当报表包含多个数据集时,数据区域外部的字段引用必须包含在指定数据集范围的聚合函数中(rsFieldReferenceAmbiguous)在线帮助文​​本框“ textboxPercentageValue”的Value表达式直接指向字段“ Variance”,而未指定数据集聚合。当报表包含多个数据集时,数据区域外的字段引用必须包含在聚合函数中它指定一个数据集范围(rsFieldReferenceAmbiguous)获得联机帮助文本框'textboxPercentageValue'的Value表达式直接指向字段'Price',而未指定数据集聚合当报表包含多个数据集时,该字段在数据区域之外必须包含在指定数据集范围的聚合函数中。 FieldReferenceAmbiguous) Get Online Help The Value expression for the text box 'textboxPercentageValue' refers directly to the field 'Variance' without specifying a dataset aggregate. FieldReferenceAmbiguous)获得在线帮助文​​本框'textboxPercentageValue'的Value表达式直接引用字段'Variance',而无需指定数据集聚合。 When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope.当报告包含多个数据集时,数据区域外部的字段引用必须包含在指定数据集范围的聚合函数中。 (rsFieldReferenceAmbiguous) " (rsFieldReferenceAmbiguous)

So what do I need to do to make this expression/formula unambiguous to SQL Server Reporting Services or the VBScript parser or "whoever" is complaining about it?因此,我需要做些什么来使该表达式/公式与SQL Server Reporting Services或VBScript解析器或“谁”抱怨的一样清楚?

I need a row value in my SSRS report that is a calculated one based on a couple of fields that are already being used in the report.我在SSRS报表中需要一个行值,该值是根据报告中已使用的几个字段计算得出的。 I want it to display in the textbox named 'textboxPercentageValue'.我希望它显示在名为“ textboxPercentageValue”的文本框中。 In semi-plain English, the expression/formula is:在半普通英语中,表达式/公式为:

If the value of the "Week" field is "WK1", display the value of the Variance field divided by the value of the Price field; otherwise, just display the value from the Variance field.

In VB script gobbledygook, the expression/formula I've add to textboxPercentageValue's Value propert is:在VB脚本gobbledygook中,我添加到textboxPercentageValue的Value属性的表达式/公式是:

=IIF((Fields!Week.Value="WK1"), Fields!Variance.Value / Fields!Price.Value, Fields!Variance.Value)

Yet, when I try to upload the .rdl file to SQL Server Reporting Services, I get:但是,当我尝试将.rdl文件上载到SQL Server Reporting Services时,我得到:

" The Value expression for the text box 'textboxPercentageValue' refers directly to the field 'Week' without specifying a dataset aggregate. When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope. (rsFieldReferenceAmbiguous) Get Online HelpThe Value expression for the text box 'textboxPercentageValue' refers directly to the field 'Variance' without specifying a dataset aggregate. When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope. (rsFieldReferenceAmbiguous) Get Online Help The Value expression for the text box 'textboxPercentageValue' refers directly to the field 'Price' without specifying a dataset aggregate. When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope. (rs 文本框'textboxPercentageValue'的值表达式直接指向字段'Week',而未指定数据集聚合。当报表包含多个数据集时,数据区域外部的字段引用必须包含在指定数据集范围的聚合函数中(rsFieldReferenceAmbiguous)在线帮助文​​本框“ textboxPercentageValue”的Value表达式直接指向字段“ Variance”,而未指定数据集聚合。当报表包含多个数据集时,数据区域外的字段引用必须包含在聚合函数中它指定一个数据集范围(rsFieldReferenceAmbiguous)获得联机帮助文本框'textboxPercentageValue'的Value表达式直接指向字段'Price',而未指定数据集聚合当报表包含多个数据集时,该字段在数据区域之外必须包含在指定数据集范围的聚合函数中。 FieldReferenceAmbiguous) Get Online Help The Value expression for the text box 'textboxPercentageValue' refers directly to the field 'Variance' without specifying a dataset aggregate. FieldReferenceAmbiguous)获得在线帮助文​​本框'textboxPercentageValue'的Value表达式直接引用字段'Variance',而无需指定数据集聚合。 When the report contains multiple datasets, field references outside of a data region must be contained within aggregate functions which specify a dataset scope.当报告包含多个数据集时,数据区域外部的字段引用必须包含在指定数据集范围的聚合函数中。 (rsFieldReferenceAmbiguous) " (rsFieldReferenceAmbiguous)

So what do I need to do to make this expression/formula unambiguous to SQL Server Reporting Services or the VBScript parser or "whoever" is complaining about it?因此,我需要做些什么来使该表达式/公式与SQL Server Reporting Services或VBScript解析器或“谁”抱怨的一样清楚?

A text box can get knocked out of its context and still appear to be in it.一个文本框可以从它的上下文中删除,但看起来仍然在其中。 I came by this post looking for the same error message and it was one textbox in a series of several and it had worked just moments before I had readjusted formatting.我通过这篇文章来寻找相同的错误消息,它是一系列文本框中的一个文本框,它在我重新调整格式之前几分钟就起作用了。 After getting the info in the first answer, I went back and poked around and found the textbox throwing the error was actually be the list box but appeared to be on the same levels as the others unless I was trying to move or resize the list box.在获得第一个答案中的信息后,我返回并四处寻找,发现抛出错误的文本框实际上是列表框,但似乎与其他列表框处于同一水平,除非我试图移动或调整列表框的大小. Moving the textbox out and dropping it back in fixed things.将文本框移出并将其放回固定位置。 As someone coming upto speed on SSRS from a programmer prospective, the insight in the first answer solved a frustration that has come up repeatedly!作为从程序员的角度快速了解 SSRS 的人,第一个答案中的洞察力解决了反复出现的挫败感!

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

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