Posted 12 September 2017, 2:43 am EST
Hello,
I am using AR 11 version 11.1.9726.0. I am using Page Report which has tablix control with expression field. When i generate the report the expression field shows the value as ‘NaN’ (because divide by zero).
I want to replace the ‘NaN’ value with 0, can you provide me a solution how to do this.
Please run the attached sample project and notice the ‘Expr’ column for ‘NaN’ values.
Where the expression value is
“=SUM(Fields.Item(“Inv Total Charge”).Value)/SUM(Fields.Item(“Inv Num”).Value)”
Note: This report is generated dynamically and the field information(including expression) coming from SQL database.
Replacing above expression with below expression i get the expected results without ‘NaN’.
“=IIF((IsNothing(SUM(Fields.Item(“Inv Num”).Value))=True), ToDouble(“0”).ToString(”#,##0.00"), SUM(Fields.Item(“Inv Total Charge”).Value)/SUM(Fields.Item(“Inv Num”).Value))"
But the problem is i have to parse the expression and find the denominator field or fields and add expression validations. Is there any alternate solution handle the ‘NaN’ values like this. Using this value still shows ‘NaN’ value.
=IIF(IsNothing(SUM(Fields.Item(“Inv Total Charge”).Value)/SUM(Fields.Item(“Inv Num”).Value))=True, ToDouble(“0”).ToString(“#,##0.00”), SUM(Fields.Item(“Inv Total Charge”).Value)/SUM(Fields.Item(“Inv Num”).Value))
Thanks,
Anwar