Select to view content in your preferred language

Prepopulating Survey123 Repeat Group with Household Members from CSV Based on HouseholdID

134
3
3 weeks ago
AndrewPadilla
Frequent Contributor

Hi GeoNet Community!

I am working with Survey123 and XLSForm, and I want to dynamically prepopulate a repeat group with household members from a CSV file. Each household member should have their own repeat record, populated with data from the CSV, based on their HouseholdID.

Here's the scenario:
I have a CSV (vPersonTable123.csv) that contains household information with columns for HouseholdID, person_name, and Notes. I want to create a repeat group where:

  • Each household member has their own record in the repeat.
  • The PersonName and Notes are prepopulated for each member based on their HouseholdID.

    I want to avoid using a select_one_from_file field, as I need the repeat to dynamically load all members based on the HouseholdID.

    Here's what I’ve tried so far:

    typenaemlabelcalculation
    integerHouseholdIDHouseholdID 
    begin repeathousehold_membersHousehold members 
    select_one_from_file vPersonTable123.csvperson_namePersonNamepulldata("vPersonTable123.csv", "HouseholdID", "name", ${HouseholdID})
    textperson_noteNotes:pulldata("vPersonTable123.csv", "person_note", "name", ${person_name})
    end repeat  

     

    However, this isn't returning the expected result. Instead of allowing for multiple prepopulated records based on the CSV file, it seems to only pull one result.

    How can I correctly populate the repeat group with each household member’s data, without needing a select_one_from_file dropdown? Any guidance or examples would be greatly appreciated!

     

0 Kudos
3 Replies
DougBrowning
MVP Esteemed Contributor

No you cannot prepopulate more than 1 repeat at a time.

0 Kudos
AndrewPadilla
Frequent Contributor

Bummer, I was so hopeful. Thanks @DougBrowning. I'll head back to the drawing board!

0 Kudos
DougBrowning
MVP Esteemed Contributor

I think maybe with repeat count it will load X number at once.  Then as they scroll through them the pulldata should fire as they go.  That may be enough for you?  It will just not load them until they scroll to them.   Not sure how you would control which one loads in each repeat though.

0 Kudos