Previous values - Repeat groups

1074
5
01-26-2021 09:28 AM
MauricioGiraldo
New Contributor II

Dear all,

I hope all is well. I would like to know if is possible to copy or duplicate the previous data in the next group repeat questions.

We need to add new information in the new group based the previous data (repeat group), in this way the idea is to have per default the previous data.

In advance, thanks!

Tags (2)
5 Replies
IsmaelChivite
Esri Notable Contributor

Hi Mauricio. You may want to have a look at the position(..) and indexed-repeat() functions. These are documented in the Early Adopter Community site and are planned to be made available and documented in our next update (version 3.12)

MauricioGiraldo
New Contributor II

Thanks Ismael. 

In fact, I share one example:

Into the first visit the doctor asked and filled the Clinical history of a person, but during the second visit, another doctor needs to check if the data is complet; In this way, the second doctor needs to complement based the first data (No modify the original information).

Thanks

0 Kudos
DougBrowning
MVP Esteemed Contributor

Ismael I was testing this but it is a no go.  indexed-repeat will let you SEE the previous value, but no you cannot inherit it into the field since that causes a cyclical loop.  Which is a major bummer.  123 cannot tell the diff between FieldA in repeat 1 and FieldA in repeat 2.  So it says I cannot copy FieldA to FieldA.

Unless someone has thought of something.  I posted all of this in the early adopter forum.  For us we really just want a Same as Last Repeat button like we had in our old app.  Would be a huge time saver.

https://earlyadopter.esri.com/project/forum/thread.html?cap=e69ef91f45744b98882c651f7b518eb7&forid={... 

I am not sure this is fixable the way 123 works.  

Now if you want to carry over say the max value or something I have got that to work.  See my post here  https://community.esri.com/t5/arcgis-survey123-questions/pulling-data-from-the-previous-repeat/td-p/...

and here

https://community.esri.com/t5/arcgis-survey123-questions/populate-a-field-within-a-repeat-from-a-pre...

Hope that helps

0 Kudos
Strahanjen
Occasional Contributor II

I, too, need to carry values from one repeat to the next. Essentially, I need a duplicate button that would allow the user to copy all values from the prior repeat into a new record in the table. Is this now possible?

0 Kudos
DougBrowning
MVP Esteemed Contributor

As you can see I have been trying to do this for 3 years now.  I really need it.

I did get a javascript way to work but for me my repeat is too big and it causes a out of memory crash on the iPad.  You can try it and see if your repeat is small enough.

I have attached the javascript code here.

To call it looks like this in the calculation column.  Note I use a radio button that allows the user to add them or not.

if(${UseDefaults}='Yes',pulldata("@javascript", "functions.js", "sameaslast", ${nameofrepeat}, currentindexasnumber, "FieldName"),'')

Hope it works for you.  I thought there was a Idea to upvote but I cant find it.

0 Kudos