Select to view content in your preferred language

Absolute Value function, abs()

1201
3
12-22-2022 03:28 PM
Status: Open
Labels (2)
MattEdrich
Frequent Contributor

I am very curious why Survey123 doesn't seem to support the standard absolute value function! I read Ismael's reply here (Solved: Re: Does Survey123 support the absolute value func... - Esri Community) regarding the issue, and reviewed the 4-step method he proposed for achieving the result. It seems to me that the inclusion of a simple abs() function to return a positive value from a calculation is a no-brainer and would save those of us with the need a lot of extra computational steps.

I am attempting to calculate the amount of twist and out-of-plumbness of telecom towers from field observations. These calculations involve taking the natural log of computed values, which may be symbolically represented as negative values to account for the conditions under which certain observations are made. This means that there will doubtless be times when my observed values in the form mathematically compute to a negative number, though any human engineer analyzing my data would doubtless understand that there really aren't negative values in this context, but rather clockwise/counterclockwise twist directions and off-plumbness directions from the nadir, all of which can be logically understood as positive vectors. 

I would love to be able to program such equations into Survey123 to dramatically lighten the post-fieldwork processing of this data, without having to jump through weird programming hoops. I doubt I am the only one wanting something like this!

3 Comments
AntoinevanEsch

Hi @MattEdrich 

I was running into a similar issue last week. Abs function is at the moment not supported in survey123 Connect. I solved it by using an if statement. 

if(condition, a, b)

In your case:

if(calculation>=0,calculation, calculation*-1)

Hope this will help you out 🙂

 

MattEdrich

Hey @AntoinevanEsch!

I was experimenting with that exact if statement yesterday. I thought that would work for sure, but I am still unable to return a calculation. It is definitely possible that there is something else going on with my logic that is causing this, but I am unsure what that might be 😛 

if(${twist_section_d}>0,log(${twist_section_d}),log(${twist_section_d}*-1))
DeonLengton

Hi All

I found a better way to perform the Absolute math function.

pow(pow(${value},2),0.5)

By squaring a value and the finding its square root you are able to calculate the absolute of a value.