I have the following expression in an SSRS report.
=IIf((Fields!carrier_code="FDEG"), CDbl(Sum(Fields!total_weight.Value)), CDbl(Sum(Fields!total_weight.Value) + 45))
I have also tried and get same error.
=Format(IIf((Fields!carrier_code="FDEG"), Sum(Fields!total_weight.Value), Sum(Fields!total_weight.Value) + 45),"##.##" )
The exact error is:
Severity Code Description Project File Line Suppression State Error [rsCompilerErrorInExpression] The Value expression for the textrun ‘textbox22.Paragraphs[0].TextRuns[0]’ contains an error: [BC30311] Value of type 'Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.Field' cannot be converted to 'String'. C:\Dev2015\OEGDevelopment\OEG.RDL.Reports\Reports\BillOfLadingReport.rdl 0
So I used CDbl because I thought it could convert the numeric value. Can someone please tell me how to fix this? Thanks!
I suspect the error is related to Fields!carrier_code="FDEG"
. I believe in SSRS you need to add .Value
when evaluating a field.
Fields!carrier_code.Value="FDEG"