Hi Everyone,
I’ve been working on some Survey123 Connect calculations to populate a survey question with an answer based on values contained in a separate feature layer called “Building Permits.” In that layer, the amount collected for an electric permit is stored in a field called “Electric_Amount.”
What I would like to do is update a question (called “erw_paid”) in a survey form linked to our Building Inspection layer based on the value of that payment field. If the “Electric_Amount” field contains anything other than “NaN”, I would like to have a question in the Building Inspection form update its value to “Yes.” The layers share a key field called “Permit ID”, so certain values can be retrieved using a “getValue” function.
I’ve been trying to accomplish this using a hidden field populated with a pull function and some logic responding to the value of that field, but the question never updates with the desired value when the form is opened. I’ve tried setting parameters for both to “calculationMode=auto”, but the calculation for the “erw_paid” question never seems to trigger even though it isn’t being held back by a relevant function. I’ve attached an Excel with the relevant lines, but I’ll include short snippets below as well:
Question 1:
Question 2:
- Type: select_one yesno
- Name: erw_paid
- Calculation: if(${elec_hidden} != 'NaN', 'yes', 'no')
Can anyone tell me where I might be going wrong here?