I am new to CF Report Builder, but can't seem to get a simple
IF statement to work.
IIf(query.costs_total_construction is 0,
DE("n/a"),
((query.costs_nonIHS_funds_new_space /query.costs_total_construction) * 100))
The report continues to fail when the value of the denominator is 0, with the error "Division by zero is not allowed." Even though the logic handling should return a string of "n/a" when this 0 is encountered.
However, I did some debugging and if I change it to:
IIf(query.costs_total_construction is 0,
DE("n/a"),
DE("Not 0"))
The report runs successfully and returns the string "n/a" whenever the value for "Costs_Total_Construction" is 0.
I built these in the "Expression Builder" for an individual field within the report.
So, the IF statement appears to work in the 2nd example.
Any ideas why the 1st example doesn't work. The divide by 0 error shouldn't occur since the division should not occur when the value is 0 and the string "n/a" should be returned.
Any help would be appreciated!!
IIf(query.costs_total_construction is 0,
DE("n/a"),
((query.costs_nonIHS_funds_new_space /query.costs_total_construction) * 100))
The report continues to fail when the value of the denominator is 0, with the error "Division by zero is not allowed." Even though the logic handling should return a string of "n/a" when this 0 is encountered.
However, I did some debugging and if I change it to:
IIf(query.costs_total_construction is 0,
DE("n/a"),
DE("Not 0"))
The report runs successfully and returns the string "n/a" whenever the value for "Costs_Total_Construction" is 0.
I built these in the "Expression Builder" for an individual field within the report.
So, the IF statement appears to work in the 2nd example.
Any ideas why the 1st example doesn't work. The divide by 0 error shouldn't occur since the division should not occur when the value is 0 and the string "n/a" should be returned.
Any help would be appreciated!!