Select to view content in your preferred language

Autopopulate a field based on previous question

261
2
Jump to solution
03-08-2026 07:30 PM
GeoWorld13
Emerging Contributor

I have a select_one question asking for County. Based on that selection, I want to calculate/assign a Region. I want that Region to be auto-populated based on the County selection.

what I currently have in the calculation cell: pulldata("@choice",'region','name',${jurisdiction})

Survey design and results:region.png

See what I am doing wrong?

@DougBrowning 

@jcarlson 

0 Kudos
1 Solution

Accepted Solutions
hmorgan
Occasional Contributor

 

You’re very close. The issue is that your pulldata() syntax is incorrect for XLSForm. In pulldata(), the second argument must be the column you want returned, not "@choice".

Correct Syntax

Use:

 

 
pulldata('region','region','name',${jurisdiction})
 
Explanation

pulldata('file','column_to_return in the csv','lookup_column in the csv','lookup_value')

So in your case:

  • file → region (the name of the CSV file without .csv)

  • column_to_return → region

  • lookup_column → name

  • lookup_value → ${jurisdiction}

Meaning: Look in the region.csv file, find the row where name = selected jurisdiction, and return the region value.

View solution in original post

2 Replies
hmorgan
Occasional Contributor

 

You’re very close. The issue is that your pulldata() syntax is incorrect for XLSForm. In pulldata(), the second argument must be the column you want returned, not "@choice".

Correct Syntax

Use:

 

 
pulldata('region','region','name',${jurisdiction})
 
Explanation

pulldata('file','column_to_return in the csv','lookup_column in the csv','lookup_value')

So in your case:

  • file → region (the name of the CSV file without .csv)

  • column_to_return → region

  • lookup_column → name

  • lookup_value → ${jurisdiction}

Meaning: Look in the region.csv file, find the row where name = selected jurisdiction, and return the region value.

GeoWorld13
Emerging Contributor

@hmorgan thanks for the reply! That worked!