Select to view content in your preferred language

survey123 connect using csv file to select a subset of data

486
6
01-24-2025 02:55 PM
jamiehollingsworth
Emerging Contributor

hello,

I am brand new to the survey123 world.  i am hoping to build a survey to be used offline.   the data to be collected is tree diameter and health.  i have a CSV file that has the data from a pervious inventory.  i attached a simplified version of it.  the idea is to go the field (no wifi/cell) select a location from a site list.  then select a plot from a list based on the location. not all locations have the same plot numbers or number of plots.  That then would create a repeat group with all the tress found at that location in a given plot.   the concept seemed simple but i am getting no where with the samples or videos. 

I started with pulldata in the calculation column but if i read that correctly i can't filer by location and plot because those values repeat.

then i moved to search() in the appearance column.  i failed to get that to work.

i was envisioning lots more functionality but i struggling with what i thought would be easy..

i completed several trainings and watched a number of videos. I have been working through the blog post and forum posts.

there is no spatial information included in this survey.

i also realize that there are likely many ways to solve this.    

any and all help welcomed

thanks

j

 

0 Kudos
6 Replies
DougBrowning
MVP Esteemed Contributor

If I am following you may get farther by creating a unique key.  Looks like site + plot + tree may work.  Use this for the lookup.

0 Kudos
jamiehollingsworth
Emerging Contributor

thanks for the reply Doug

sorry i was not super clear in my first post as to what functionality looking to create.

i want to create a survey that will allow the user to fist select site. (text)  i think i can do this using either the choices tab or a CSV file.  

the next step based on the first step. is to select a plot (integer) that is found at a specific site.  i think the method choices are a choice filter or a cascading list.  i can not get either to work.

if i can chose a site and plot then within that plot there are individually numbered trees.  i want to now be able to view the information about ALL these trees.  basically auto populate the tree number, species and DBH ect using the CSV file that has historical data into.  Then be able to enter addition data like current DBH or if its still alive.  seems like a repeat would work for that but i am stuck.  

i am not sure how to use the unique key in a lookup as you suggest.

i have seen other posts where information is auto populated but...

i see some information on indexed-repeat but am not sure how to use it my my case.

 

 

0 Kudos
DougBrowning
MVP Esteemed Contributor

You need a 1 to 1 lookup key is all.  

Right now your csv has no unique lookup key is why you are stuck.  Its like going into a room and saying Jamie raise your hand - and 4 people do.  But if you say first, middle, and last name then it works.

Hope that makes more sense.  For you just make a column with all 3 together.  Then in your form use a concat field to also combine.  Then use this for your lookup.  Give it a shot it will probably click on a test.

0 Kudos
jamiehollingsworth
Emerging Contributor

thanks Doug,

  i did create an unique ID column and that has gotten me a bit further along but it seems i am going need some serious hand holding to get this worked out. I have also been struggling to find examples.

currently when the app first loads it displays all the records in the select_one data search('treedata','startswith','name', ${s_p_con}) question.  i can filter it down to just one site and and one plot by answering the question above.  so functional it works, but not sure why it is showing all the data at the start and not waiting until its filtered.    I had wanted to be able to count all the records for any combination of site and plot and get them into a repeat i can scroll through.  

this probably is not making any sense.

i attached the data and form

 

using count or position()..

 

0 Kudos
DougBrowning
MVP Esteemed Contributor

You did not add sites.cav so I cant test.  But it seems like it works ok to pull the data?  If you do not want to see the whole list add a relevant on it so it does not show up until the other fields are filled in.  You can use string-length > 0 usually for the relevant.  Common way to do it.

You could also just go to one drop down to bit the combined ID right from the start.

0 Kudos
jamiehollingsworth
Emerging Contributor

thanks Doug,

sorry i forgot to add the sites.csv.  i changed the trees.xlsx to refence the choices tab for site selection.  Adding the string-lenght(${s_p_con}) >0 removed the unfiltered list.    So i have to select an individual  tree to be able to add a new diameter measurement.  When i use the complete historical dataset the list of tree numbers will be in the hundreds making the list hard to use.  Tracking which trees have been completed will be difficult.  i thought that a repeat would let me scroll back and forth through the list that matches the site and plot criteria?  i want to be able to know how may trees are left to measured with a running count. also be able to avoid entering the same tree twice by showing the diameter that was just entered. i am getting the feeling that this level of complexity needs Java Scripts?

thanks for your help

attached is the newest xlsx

 

0 Kudos