Survey123 Formula Question (ABS)

182
4
05-22-2018 06:31 PM
Highlighted
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)
Reply
0 Kudos
4 Replies
Highlighted
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})

Highlighted
Occasional Contributor II

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

Reply
0 Kudos
Highlighted
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.

Highlighted
Occasional Contributor II

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

Anu

Reply
0 Kudos