[英]SSRS Grouping based on parameter
I am trying to group my report based on a parameter but get the following error when I try to run the report 我正在尝试根据参数对报告进行分组,但是在尝试运行报告时出现以下错误
The GroupExpression for the tablix 'Tablix1' contains an error: [BC30311] Value of type 'Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.Parameter' cannot be converted to 'String'
Tablix'Tablix1'的GroupExpression包含错误:[BC30311]类型'Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.Parameter'的值不能转换为'String'
The expression I have got so far is 到目前为止,我的表达是
=IIF(Parameters!ParameterName = "Name", Fields!Field1.Value
AND Fields!Field2.Value
AND Fields!Field3.Value,
Fields!Field2.Value
AND Fields!Field3.Value
)
What I am expecting the above to do is if the Parameter = Name then group 3 different fields else if the parameter is anything but Name then group on only 2 fields, these 2 fields are also used in the first half of the IFF statement 我期望上面要做的是,如果Parameter = Name,则将3个不同的字段分组;否则,如果参数不是Name,则仅对2个字段进行分组,这2个字段也用于IFF语句的前半部分
I guess this is a datatype issue, if so then ideally I would like to fix it in SSRS NOT in the SQL stored procedure but if not then fixing it in SQL is not the end of the world 我想这是一个数据类型问题,如果是的话,那么理想情况下,我想在SSRS中修复它,而不是在SQL存储过程中,但是如果不是,那么在SQL中修复它就不是世界末日了。
This may be a very simple question but pretty new to SSRS 这可能是一个非常简单的问题,但对SSRS来说还是一个新问题
Try this ... 尝试这个 ...
=IIF(Parameters!ParameterName = "Name", cstr(Fields!Field1.Value) +
cstr(Fields!Field2.Value) + cstr(Fields!Field3.Value),
cstr(Fields!Field2.Value ) + cstr(Fields!Field3.Value)
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.