Survey123: pulldata from .csv within a repeat question

469
8
04-21-2021 01:29 PM
AlinaT
by
New Contributor III

I have a survey that uses the pulldata function within a repeat to prepopulate info from several .csv files that are stored in the Media folder. I would like to be able to edit a partially completed survey, but it seems like the pulldata function will not retrieve the data from the .csv past the last record that was inspected.

The survey is for hydrant flushing and depending on which day of the week is selected, the user has to step through a list of hydrants that need to be flushed in a certain order. One day of flushing= one survey submitted. I would like to change the workflow and allow people to save a draft after each hydrant flushed or submit a partial survey and be able to edit that survey as they move to the next hydrant.  

I have looked at previous posts that mention the esri::bind:: paramater field and tried to add the "allowUpdates=true query" statement but that didn't help. I am able to continue editing within the repeat, but I can't see the hydrant info from the .csv file. 

Thank you!

 

Tags (1)
8 Replies
DougBrowning
MVP Frequent Contributor

There is a known issue with calculations not firing when coming back from a draft.  This has been causing me pain as well.  We flip between forms so this causes us lots of issues.  (I also asked for a way to have multiple forms open at once.)  I have talked to the 123 team but no timeline yet.

I had a post on it I thought but this is the one that comes up (I may have posted in early adopter).  Issue goes back to at least 2018.  https://community.esri.com/t5/arcgis-survey123-questions/calculate-field-not-working-properly-after-...

Sometimes we got it to go by having a dummy field that we flip yes/no to get the calc to fire.  You can wrap the calc in a if (dummy=yes) then it will fire on a change.  The form needs something to change for it to "refire".  Using relevant may help also.

Other option is to have 1 form per hydrant.  That way you get spatial info (what if they flushed the wrong one), editor tracking and all that as well.  You could use Inbox to load them in or use Collector, or even workforce, to give them a list of where to go then launch to 123.

Hope that helps

AlinaT
by
New Contributor III

Thank you Doug. Can you provide some more information on using the dummy field? I am not sure I understand how that would work.  

DougBrowning
MVP Frequent Contributor

Wrap your pulldata calc in a if(dummy=yes, pulldata, pulldata).  Make dummy a yes/no field.  The if part forces a recalc when the dummy field changes - which will then get your pulldata to fire.

Does that make more sense?

AlinaT
by
New Contributor III

Sorry, I feel like a dummy 🙂  So is  the dummy field something that the survey responder would flip yes/no when returning to edit an existing survey? 

DougBrowning
MVP Frequent Contributor

yep the change to the dummy should cause the field that has pulldata in it to refire and get your data.  Just give it a shot it is quick to test.

AlinaT
by
New Contributor III

I tried adding a dummy field but that didn't seem to help. Unless I'm not adding it in the right place within the .XLS Form?  I tried both the if(dummy=yes, pulldata, pulldata) in the calculation field as well as adding the dummy=yes in the relevant column. I think the issue for me is with a counter value that I have set up to keep track of where to lookup in the .csv within the repeat.  I did a test and added a manual counter, basically asking the user to input the hydrant number they wanted to flush and that did seem to return the appropriate values when editing an existing survey .However, I was still unable to move on to the next hydrant within the repeat.  I might just have to redesign this whole thing, and have one survey per hydrant... Unless someone else has some ideas! 

There was one way I found I could edit an existing survey and be able to get the pulldata to work properly. It worked if at the beginning of the survey I cycled through all the hydrants that needed to be flushed within that repeat. I could then save a draft or even send the survey and be able to edit the responses. 

Thank you!

0 Kudos
DougBrowning
MVP Frequent Contributor

Sorry I was out of town.  Have you tried used position(..) instead of the count?

0 Kudos
AlinaT
by
New Contributor III

No, I have not, I am not familiar with that function. I have since redesigned the whole survey and got rid of all the repeats. Now I can edit everything in the submitted surveys if needed.