if in Calculation

245
3
08-13-2020 01:52 PM
ReneAubut
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

0 Kudos
3 Replies
ZacharySutherby
Esri Regular Contributor

Hello Rene Aubut‌, 

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

Please use this link for reference: Formulas—ArcGIS Survey123 | Documentation 

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
0 Kudos
ReneAubut
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

0 Kudos
DougBrowning
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