Populate an answer using another answer

216
4
Jump to solution
12-09-2021 08:19 AM
JenAmes
New Contributor III

Is it possible to populate a question using information filled in on another question, dependent on the answer to another question?

I'm trying to modify the Damage Assessment Survey that comes in the Damage Assessment Solution to better suit my municipalities needs. We have a select one question asking if the point of contact is the property owner, an occupant, or both owner and occupant of the property. Then there's a set of questions asking point of contact's information, and another section asking owner information. What I'd like to do, is if "Owner" or "Owner/Occupant" is selected, to have the point of contact information populate into the owner information.

I tried using this expression in the calculate section:
if(selected(${represent}, 'Owner'), ${contactname}, '')
where ${represent} is the select one question described above, and the '' at the end is two single quotes to prompt leaving the question blank

I've tried the above expression, and it didn't work. I've tried the above expression with words in the final single quotes, and it worked fine UNLESS I selected "Owner". I've tried the expression with ${contactname} in single quotes, which returned a file path.

Is it possible? Am i using the wrong expression, or missing something in syntax?

0 Kudos
1 Solution

Accepted Solutions
SayedWali
New Contributor III

Hi @JenAmes 

You can use this expression instead of the one you have used:

if(selected(${represent},'Owner') or selected(${represent},'Owner/Occupant'),${contactname},'')

Hope this works,

Wali

View solution in original post

0 Kudos
4 Replies
ZacharySutherby
Esri Regular Contributor

Hello @JenAmes

If possible would you be able to provide a copy of your XLSForm for testing on our end? I've tested with a simple survey and the calculation is working correctly. 

Thank you,
Zach
0 Kudos
JenAmes
New Contributor III

Here's my file. It's not based on a feature service like the original survey with the Solution is.

0 Kudos
SayedWali
New Contributor III

Hi @JenAmes 

You can use this expression instead of the one you have used:

if(selected(${represent},'Owner') or selected(${represent},'Owner/Occupant'),${contactname},'')

Hope this works,

Wali

0 Kudos
JenAmes
New Contributor III

I swear I used the exact same syntax previously and it didn't work. But it did this time, so that's all that matters. Thanks for your help!

0 Kudos