Hello everyone,
I can't seem to create a Survey where the repeat values are prepopulated with the same values as the last record inserted in the repeat (I'm also using the Inbox option).
Let me explain:
I have a form with a geopoint and a repeat that contains two values: date and note
Geopoint
Repeat
-date
-note
end repeat
The surveyor has to find the nearest point to him (use Inbox) and has to insert a new repeat record with the date calculated automatically (I know how to do it) and a new note whose value must not be empty but must be prepopulated by the value of the previous note (I don't know how to do it).
I tried using the indexed-repeat () function but I get a cyclic error.
Do you have any suggestions?
Thank you in advance for your attention,
Paolo
I was able to resolve this bug by making the select_one a required field. Hope this helps someone!
Hi Doug,
I've implemented the function you provided in my own survey (thank you). I am more curious than anything-- why is it [position - 2] and not [position - 1]?
Its been a long time so I forget. I think it may be 0 based index vs 1 based index.
If I remember right it was that 123 was 1 based index and JS is 0 based index. So they are 1 different than each other. I got this code from someone else on here and modified it so its not really mine. I am still seeing position() cause loop warnings in Connect.
@DougBrowning-- I see you've been the OG on this topic for at least the last 7 years! Any fresh developments on the horizon? It seems like the ability to default to previous iterations in a repeat is a pretty basic function.
I tried your JavaScript workaround and it worked when the field was set to 'text', but not with the 'select_one' field I’m using. I'm trying to set up a list of foresters for initial user selection, and I want this selection to be carried forward as the default in subsequent iterations. Any ideas?
At Dev Summit they did a demo of the new 123 build that will be in .NET now. One of the things they showed was a repeat as a table with a "Duplicate" option. That is based on my bugging lol. I am still not sure if it will be able to handle a repeat with a lot of fields though. The new build is probably close to a year out still though.
So kind of new info but nothing ready to use today.
I used the javascript on a select one I think. Are you using the name values and not the label values? In the end my repeat was too large so it never did work for me. So not positive.
We used a defaults list in the end which helped a little.
Thanks @DougBrowning! The squeaky wheel gets the grease (even if it's 8 years later) 🙂
I got the select_one working using the 'autocomplete' appearance -- just doesn't like 'minimal' appearance for some reason.
Oddly enough, I got the select_one minimal appearance to work with the JS just by making a required field 🤔