Use*_*999 17 aggregate concatenation reporting-services ssrs-2008 ssrs-expression
我收到以下错误:
Error 1 [rsInvalidAggregateScope] The Value expression for the text box
‘Textbox2’ 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.
Run Code Online (Sandbox Code Playgroud)
我的Textbox2背后的表达式(我添加了一些空格以便于阅读):
Iif(Parameters!ReportParameterPersoneelsNr.Value.Equals(String.Empty),
"Prestaties " + First(Fields!firmanaam.Value, "DataSetHrm") +
"(" + First(Fields!indienstfirmanr.Value, "DataSetHrm") + ")",
"Prestaties " + First(Fields!naam.Value, "DataSetHrm") + " " +
First(Fields!voornaam.Value, "DataSetHrm") +
"(" + First(Fields!personeelsnr.Value, "DataSetHrm") + ")")
Run Code Online (Sandbox Code Playgroud)
田野:
ReportParameterPersoneelsNr = Reportparameter of type Text
firmanaam.Value = VARCHAR
indienstfirmanr.Value = Long
naam.Value = VARCHAR
voornaam.Value = VARCHAR
personeelsnr.Value = Long
Run Code Online (Sandbox Code Playgroud)
对Stackoverflow的搜索给我带来了以下结果.但到目前为止,他们还没有帮助我解决我的问题
Post 1:what-does-scope-parameter-that-not-valid-for-an-aggregate-function-mean
有人能指出我做错了吗?
注意:在任何地方添加tostring()都无济于事
注意2:用'&'替换'+'也不能解决问题
注3:数据集名称正确,数据集是此SSRS报告中唯一存在的数据集:

更新:数据集包含的数据有效,并且读取数据集不起作用(尝试使用和不使用别名)
有时这个错误发生在我们使用不同DatasetName的时候Experssion.
就像在我的情况下,我通过做下面的事情解决了这个错误,
在下面之前,
="For Man " +
IIF(Len(First(Fields!Lname.Value, "DataSet1")) > 0,
First(Fields!Lname.Value, "DataSet1"),"") & IIF(Len(First(Fields!Fname.Value, "DataSet1")) > 0,
", " + First(Fields!Fname.Value, "DataSet1"),"")
Run Code Online (Sandbox Code Playgroud)
把它改成下面后现在工作正常,
="For Man " +
IIF(Len(First(Fields!Lname.Value, "LastChangedDataSetName")) > 0,
First(Fields!Lname.Value, "LastChangedDataSetName"),"") & IIF(Len(First(Fields!Fname.Value, "LastChangedDataSetName")) > 0,
", " + First(Fields!Fname.Value, "LastChangedDataSetName"),"")
Run Code Online (Sandbox Code Playgroud)
注意:所以这里的错误是我已经将 DataSet Name From更改DataSet1为LastChangedDataSetName并且仍然Expression在更改 DataSet Name之前更改了我已经写过的名称.
我不知道出了什么问题,但是创建了一个类似的报告.创建一个新的空白报告,然后使用以下查询创建一个数据集(来自SQL Server):
SELECT'ACME'AS firmanaam,10000 AS indienstfirmanr,'Doe'AS naam,'Jon'AS voornaam,987654 AS personeelsnr

然后添加您的参数

在报告中添加一个文本框,代码如下:
= Iif(Parameters!ReportParameterPersoneelsNr.Value.Equals(String.Empty), "Prestaties " & First(Fields!firmanaam.Value, "DataSetHrm") & "(" & First(Fields!indienstfirmanr.Value, "DataSetHrm") & ")", "Prestaties " & First(Fields!naam.Value, "DataSetHrm") & " " & First(Fields!voornaam.Value, "DataSetHrm") & "(" & First(Fields!personeelsnr.Value, "DataSetHrm") & ")")
Run Code Online (Sandbox Code Playgroud)
然后运行带有或不带参数值的报告:


| 归档时间: |
|
| 查看次数: |
46618 次 |
| 最近记录: |