SSRS 报告表达式错误“无法转换为字符串”

问题描述 投票:0回答:1

我在 SSRS 报告中有以下表达式。

=IIf((Fields!carrier_code="FDEG"), CDbl(Sum(Fields!total_weight.Value)), CDbl(Sum(Fields!total_weight.Value) + 45))

我也尝试过并得到同样的错误。

=Format(IIf((Fields!carrier_code="FDEG"),  Sum(Fields!total_weight.Value), Sum(Fields!total_weight.Value) + 45),"##.##" )

确切的错误是:

严重性代码描述项目文件行抑制状态 错误 [rsCompilerErrorInExpression] textrun 'textbox22.Paragraphs[0].TextRuns[0]' 的值表达式包含错误: [BC30311] 'Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.Field' 类型的值无法转换为 'String '。 C:\Dev2015\OEGDevelopment\OEG.RDL.Reports\Reports\BillOfLadingReport.rdl 0

所以我使用了CDbl,因为我认为它可以转换数值。有人可以告诉我如何解决这个问题吗?谢谢!

reporting-services expression
1个回答
0
投票

我怀疑该错误与

Fields!carrier_code="FDEG"
有关。我相信在 SSRS 中,在评估字段时需要添加
.Value

Fields!carrier_code.Value="FDEG"
© www.soinside.com 2019 - 2024. All rights reserved.