Select to view content in your preferred language

Auto populate answers in repeats from previous repeats; and extract information from repeats based on position within repeats

5403
8
12-10-2018 01:26 PM
Status: Open
NathanDulfon
Occasional Contributor

Hello ESRI team,

I have hit a wall in the development of a form that is used to collect plant data in plots along several beltline transects...

I got the survey to work originally by using many select_one types in the form... then I learned about the performance issues with pulling too much information from the choices in the xlsForms.... and how it increases the form load time on your phone....

Then I tried using the pulldata() from .csv, cascading selects, and external selects to alleviate the performance issues... this did not fix the problem... So, it seems that using repeat sections for each plot along each transect may answer my need and others needs.... the only problem is.... I now need to add some sort of calculation that can extract the plant names from the first repeat and pull them into the next repeat.... and that repeat into the next.... that way the species are in order of occurrence and don't get mixed up...... so I can analyze the information the data in an analysis section of the form....

I have found such calculation using ODK (open data kit) which uses the exact same xlsForms and format for producing surveys.... the calculation that extracts answers within each repeat based on position is:

indexed-repeat(namegroupi[sub_grpsub_i[sub_sub_grpsub_sub_i]])

The indexed-repeat() has the ability to return the response value of question name from the repeat-group group, in iteration i. Nested repeat groups can be accessed using the sub and sub_sub parameters if needed.

The indexed-repeat calculation also has the ability to copy answers for a question in a previous into the next repeat...

For example: copying plant names from frame 1 ==> frame 2.... saving time and cutting down on select_one list pulls from the choices tab.... and possibly helping with performance issues and loading times....

I would also like to see an absolute value calculation.... ODK has such a calculation.... abs() which is common to all excel files.... I use this to accomplish vegetation trend... but it is not available in Survey123.....

I recommend checking out the capabilities that ODK has developed and the coding behind the enhancements... They would benefit Survey123 connect greatly.... Survey123 is much less complex and an easier platform to work with... for christmas I wish for indexed-repeats() and repeating answers from previous repeats in Survey123.... forget about my two front teeth...

attached is an example of the xlsform I developed using ODK to extract plant names from two frames and post them into the analysis portion of my form... and I got it to work.... but I couldn't figure out how I would get the plant names to auto populate the next repeat based on the answers of the first plot.... its a dream and I know it would benefit many people and save time....

8 Comments
MaazaMekuria

It would have helped me a lot to have indexed-repeat right now.  I am not sure what the rational is to not allow the capture of repeat data either inside or outside the repeat.  At a minimum it should be available outside the repeat.  Is there any workaround this limitation, such as compiling the form using pyxform or something else and using it with only on the webform and not the app? 

The puzzling aspect of the dilemma of the missing indexed-repeat function is that one can see that the data is available as JSON within the form and yet can't seem to be able to extract it out! 

NathanDulfon

I am glad others see the utility of a index-repeat calculation in S123.... I cannot build the complexity I need using cascading selects because S123 performance crashes on me after I add to many rows in the xlsForm... however I got the repeats to work... but I cannot organize my repeats in each section to display the plants in order of how I collected them from the repeat before... this creates problems for me...

CindyJayakumar

I would like to see some input from ESRI on this. I've come up against this issue repeatedly. It's already difficult to convince internal clients to move from paper based data collection to electronic (yes, it's 2019 and I'm still having this fight), so when I can't deliver an exact replica of their paper form + added smarts, they use that as an excuse to say that mobile data capture doesn't work, and ESRI/GIS/Survey123 sucks. It's incredibly annoying, especially when I know I can design a fully integrated solution that will save time and money for them.

Perhaps James Tedrick‌ can provide some insight on this? Is enabling the indexed-repeat functionality on the roadmap? I haven't seen any mention on the beta forums yet.

JamesTedrick

HI Cindy,

There isn't a definite timeline for the indexed-repeat function.  That being said, this is not a capability that is present on paper forms (as its a calculation).

CindyJayakumar

Thanks for the quick reply James Tedrick‌. The rant about the paper forms was not aimed at the lack of indexed-repeat functionality specifically, it was more of a general sigh of frustration. I have several workarounds I use when needed, but I can only implement those after I've had to talk them down from the ledge of "It's fine, we'll just fill out 1 form on paper and get a student to duplicate it 20 times!".

Katie_Clark

This functionality would be extremely useful. It is a common workflow (as we transition to using Survey123, rather than manually entering data collected in the field into Excel spreadsheets) for me to receive an Excel document and be asked to "translate" it into a Survey and a Word Doc feature report template to automate report generation.

I've experienced limitations in being able to replicate functionality of the Excel spreadsheets because I cannot easily reference information collected within a repeat. This is easy to do in Excel, because you simply reference a previous row number in a table. (there are many somewhat complex equations in the specific document I'm thinking of, but one example is returning an error message if any subsequent values in the table (repeat values) are higher than the previous values entered. They must be entered in descending order). 

Hopefully enough people realize the powerful computation potential of this functionality and it gets added to the product plan.  

CesarAvila

Hi guys.

I need something similar about this.

Basically into the survey there is a repeat, into it, the user needs to input the time they start and finish Activity A. If the user needs to do more activities, needs to submit start and finish time on every repeat.

CesarAvila_0-1624459196374.png

Now the user is going back on the repeat to Activity A to figure it out the time he is starting Activity B (means the finish time from Activity A is going to be the start time of Activity B). There is now way to prepoluate that finish time into the start time of the next activity?

I've researched a lot but couldn't find another blog besides this one. Please let me know if it's possible @JJames.

Thanks.

Regards.

NathanMack

@JJames 
You can use an indexed-repeat with repeat index2.


typenamelabel calculation
begin repeattimesheetTime Sheet  
calculaterepeat_index1 position(..)
timestart_timeStart Time ${prev_time}
calculateprev_time  indexed-repeat(${finish_time}, ${timesheet}, ${repeat_index1}-1)
timefinish_timeFinish Time  
end repeat