Select to view content in your preferred language

Toleration of both positive and negative values

812
1
09-03-2018 01:37 AM
Lars_EngelsbyMosbech
Emerging Contributor

Hello, 

I am trying to create a calculation where i have two measurements: 

${measurement_ref} and ${measurement_act}

I have a tolerance set in the field ${measurement_tol} 

I calculate the difference ${measurement_dif} in a field by ${measurement_ref}-${measurement_act}

I want a field that tells the user that its Not OK if the difference is outside the tolerance. So far i have created this statement, but it only works if the difference is positive:

if(${measurement_dif} <${measurement_tol}, 'OK', if(${measurement_dif}>${measurement_tol},'Not OK','OK'))

I want the calculation to be able to work with both positive and negative difference values.

Can anyone please assist? 🙂

Another small thing - is anyone aware of an ISBLANK function in xlsforms? I only want to be able to see if its OK or not if there is actually something to be calculated..

0 Kudos
1 Reply
DeonLengton
Esri Contributor

Hi Lars

You should do an absolute calculation that is always positive. Survey123 doesnt have an absolute function but you can use an if statement to mimic its behaviour:

if(${measurement_ref}-${measurement_act}>0,${measurement_ref}-${measurement_act},(${measurement_ref}-${measurement_act})*-1)