IIF Syntax
I am attempting to prevent a divide by 0 error in the group footer of my report using
[IIF([grpTotSales]=0,0,[grpTotShrinkValue]/[grpTotSales])]
where grpTotSalse and GrpTotShrinkValue are Totals used in the Report
if grpTotSales is 0, the report generates an error and will not run
An unhandled exception of type 'System.Exception' occurred in FastReport.dll
Additional information: Text182: Error in expression: IIF([grpTotSales]=0,0,[grpTotShrinkValue]/[grpTotSales])
Can anyone provide the proper syntax.
[IIF([grpTotSales]=0,0,[grpTotShrinkValue]/[grpTotSales])]
where grpTotSalse and GrpTotShrinkValue are Totals used in the Report
if grpTotSales is 0, the report generates an error and will not run
An unhandled exception of type 'System.Exception' occurred in FastReport.dll
Additional information: Text182: Error in expression: IIF([grpTotSales]=0,0,[grpTotShrinkValue]/[grpTotSales])
Can anyone provide the proper syntax.
Comments
Hi,
which .NET language is set in your report? C# or VB?
For C# the expression should look like this [IIf([grpTotSales] == 0, 0, [grpTotShrinkValue]/[grpTotSales])]
For VB it should be like yours: [IIf([grpTotSales] = 0, 0, [grpTotShrinkValue]/[grpTotSales])]
I did change the statement to IIF([grpTotSales]=0,0,1) , which ran correctly, so the error is in the [grpTotShrinkValue]/[grpTotSales] expression
Bill