Select to view content in your preferred language

How to get multiple entries from a csv file?

305
3
02-22-2024 04:44 PM
PavlovaVitale
New Contributor

Hello I am hoping someone can help me with this issue. I have a survey that has multiple entries in a CSV file for example:

Watershed                     Pollutant

Los Angeles River          copper

Los Angeles River           lead

Los Angeles River            zinc

Machado Lake                 mercury

Machado Lake                  DDT

If I select the watershed to be Los Angeles River in my survey, how do I have it populate all the pollutants in the survey? pulldata only grabs the first record. I have at least 100 watersheds and multiple pollutants per watershed so I am not sure if an array would help at all. 

 

0 Kudos
3 Replies
ZacharySutherby
Esri Regular Contributor

Hello @PavlovaVitale

Are you looking to populate a text question with the pollutants or a multiple choice question? 

If you're looking to populate a text question you'll need to squash your data so that there's only 1 watershed in the CSV and then the pollutants can be a comma separated string like "Copper, Lead, Zinc". 

If you're looking to populate a multiple choice question you can keep your CSV the way it currently is and use the search() appearance.

Thank you,
Zach
0 Kudos
PavlovaVitale
New Contributor
We can't put the pollutants in one line nor the watersheds in one line because associated with each pollutant are the limits like copper has a limit of .003 and sometimes it is .02 and so they vary. I will try to figure out how to use search()
0 Kudos
abureaux
MVP Frequent Contributor

An Idea:

  1. Determine the maximum number of pollutants and label the input fields 1, 2, 3, ..., x.
  2. In the CSV, have one watershed with multiple columns per pollutant.
  3. Use pulldata in the survey to pull from each of the "pollutant" columns and dynamically hide the input fields with no pollutants.
0 Kudos