cancel
Showing results for 
Search instead for 
Did you mean: 

CE_CALC if function

0 Kudos

Hi Team,

I'm trying to use nested if condition using CE, below is my formula

CE_CALC(' if "Field1" = 0, 0, if "Field2" > "Field3", ( ("Field2" - "Field3") * "Field4" * -1 ), 0 ) ', DECIMAL(17,3)) AS "V_TEMP"

it is not returning the correct result. When I use the same condition in SQL Script, it is working fine. Is it possible to use nested if using CE function?

Thanks

Sathish

Accepted Solutions (1)

Accepted Solutions (1)

former_member182114
Active Contributor
0 Kudos

Hi Sathish,

If aren't being used correctly due to missing parenthesis.

CE_CALC(' if("Field1" = 0.0, 0.0, if("Field2" > "Field3", ( ("Field2" - "Field3") * "Field4" * -1 ), 0.0 )) ', DECIMAL(17,3)) AS "V_TEMP"

Also use 0.0 instead 0 as it's a decimal field and you avoid implict conversions.

Regards, Fernando Da Rós

0 Kudos

Hi Fernando, Thanks, using 0.0 instead of 0 resolved the issue. Thanks much for your help!

BR,

Sathish

Answers (0)