# if in Calculation

245
3
08-13-2020 01:52 PM
Occasional Contributor

Hello

anyone for what is wrong with this equation in a survey123 Calculation column

if(\${tonnage_pct}<5, if(\${temps_transport}<240,'oui','non'))

Thanks

3 Replies
Esri Regular Contributor

Hello Rene Aubut‌,

The parameters of the if() function are if(<condition>,<return X if condition is met>,<otherwise return Y>)

In your condition are you trying to say if \${tonnage_pct}<5 AND \${tems_transport}<240 return 'oui' otherwise return 'non', or are you trying to say if \${tonnage_pct}<5 OR \${tems_transport}<240 return 'oui' otherwise return 'non'?

Thank you,

Zach

Thank you,
Zach
Occasional Contributor

Thanks Zach. I need both conditions to return true. My difficulty with the IF syntax is when I have to check for more than one condition. With one condition it is straightforward.

I just tried without success

if(\${tonnage_pct}<5 AND (\${temps_transport}<240,'oui','non')

where tonnage_c is Decimal type and temps_transport is Integer

MVP Notable Contributor

Well you have an extra ( in there now

if(\${tonnage_pct}<5 AND (\${temps_transport}<240,'oui','non')

should be

if(\${tonnage_pct}<5 AND \${temps_transport}<240,'oui','non')

But if you want it to be oui if either is true then you need to use an or not an and.

Hope that helps