AnsweredAssumed Answered

# Problem with calculation when field is set to hidden or calculate

Question asked by grahaty@wsdot.wa.gov on Jul 21, 2017
Latest reply on Dec 14, 2018 by deleted-user-sNUdtFrn2yEY

I'm working on a distance calculator that will allow Protected Species Observers (PSO) to enter the compass bearing and distance to an animal they sighted from their monitoring position.  They then enter the compass bearing and distance to the noise source from their monitoring position.  From each sighting bearing it converts it to Cartesian coordinate angles and those angles are then used to calculate the angle of the triangle at PSO's location between the legs of the Animal sighting distance and Noise source distance.

It then applies the law of Cosines to calculate the distance from the noise to the animal sighting, which enable the PSO to quickly tell if the animal is in a shutdown zone or not.  In the spreadsheet I attached, everything works as designed.  However, I want to hide the Animal Modulus and Noise Modulus Results fields so the PSOs aren't seeing numbers that they don't need.  The problem I'm experiencing is when I turn those Modulus fields types to Calculate or Hidden in Survey123 Connect it breaks the math.  I updated Survey123 connect to the current version v2.3.24 today, but I believe I the problem was there in the previous version as well

For example, if I enter an animal sighting bearing of 17 deg and a Noise bearing of 122 deg, I should get an angle of 105 degrees as my result, and I do when the ModResA and ModResnN fields are set as integers.  Turning them to Hidden or Calculate and my resulting calculated angle is 73032 in the bearingangle field.  I traced the problem down farther, if I leave on of the ModRes fields set as an integer (say ModResN for this example) and enter the animal sighting bearing of 17 deg and the noise source bearing of 122 deg I get the bad result of 73032 again.  However, if I flip the value and enter 122 deg for the animal sighting and 17 deg for the noise source I get the correct angle of 105 degrees.  I do have nested if statements in the bearingangle field to choose which math should be used to calculate the angle appropriately.  Either I've made an error somewhere or calculate/hidden fields can't handle nested if statements.

Does anyone have any insight for a solution?