Survey123 Formula Question (ABS)

861
4
05-22-2018 06:31 PM
AnuSawant
Occasional Contributor II

I am basically trying to replicate IF(ABS(D4)>(E2),"Yes", "No") this formula in my survey.

Values captured in the fields D4 and E2 has been populated from different calculation which can be positive or negative, Irrespective of that it should populate the result as Yes or No.

Thanks for the help in advance.

Anu

 

Tags (1)
0 Kudos
4 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Anu,

There isn't an abs() function directly supported in Survey123.  It can be done, however with an if statement:

if(${q} < 0, -1*${q}, ${q})

AnuSawant
Occasional Contributor II

Sorry James, but you would be able to elaborate more?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Sure,

The if() statement looks to see if the value of the question is less than 0.  If it is, it multiplies it by -1, resulting in a positive value the same distance away from 0.  If it is not, it returns the value, which is either 0 or a positive number. The result is that you always get a positive number or 0.

AnuSawant
Occasional Contributor II

Thanks James, its working exactly the same way I wanted it.

Anu

0 Kudos