Hello,
Seeking ideas/direction on how to implement the following:
We have a survey with nested repeats.
We use the INBOX to load the survey and the user can make edits to the related 1st repeat.
If any edits are done, we would like to automatically create one 2nd repeat record to guide the user to indicate / record what change was implemented (read edit log). Don't need to automatically define what exactly was changed. Instead just want to create the 2nd repeat record to allow the user to update what they have changed manually.
Currently this is all working except the user must manually create an edit log record (2nd repeat). I would like to force this 2nd repeat record to at least be created automatically, knowing that the user can still delete it if they must.
Your input is most appreciated.
Cheers, BKS
Solved! Go to Solution.
Sounds like you have a good solution there! If you have no more questions, don't forget to mark your response as the accepted solution so others can benefit.
"...IF the parent record has zero associated repeat recs, it automatically creates 2 repeat records the first time..."
Sounds like you need to beef up your calculate a little. On that note, two things:
"I'm hoping that there might be a way to use position(..) and/or index to have the survey open to the last (most recent) repeat record."
This is a common ask. Unfortunately, the answer is "cannot be done" (at least presently).
"...the user is NOT able to delete the newly created repeat record..."
This is expected behaviour. As soon as you use the repeat_count column, the option to add or delete records goes away.
Sounds kind of tricky. I don't know if this would work, but perhaps your survey could use the repeat count feature to manually define the number of repeats. You could use the once function to grab the initial value of the repeat count field, then increment it by 1, put that value in.
I would guess the form will complain about circular dependencies, though. But it's worth trying, I think!
Thanks for that idea @jcarlson .
Exactly when does the new repeat record in the 2nd nested repeat (i.e. the Edit Log) get created, when I increment the repeat count by 1? By doing so you think a new repeat record would be created?
Ideally I'd like to create the Edit Log row when any RW value has been changed by the user in the form, BUT as a perhaps simpler alternative, is there a way to create this record as soon as I open the form if I'm doing so to Edit it ?
Just searching for a reasonable solution; doesn't have to be perfect. However, it would be nice to have something better than relying on the user to add a repeat record and record the change they made.
Your assistance is appreciated.
BKS
Funny thing is, this actually works without a circular reference! So, this workflow should be fine:
Ah, excellent! It's been a while since I attempted something similar, and I'd been going about it the wrong way. Thanks for actually testing it out!
Oh ya. I'll point out the obvious though. This will:
So long as you are okay with not having required fields and that empty repeat, this actually works a lot better than I would have expected.
If you add a conditional statement to the formula to swap between "count(${test_rpt})+1" and "count(${test_rpt})+0", then you'd be fine to ignore the above.
Because this worked better than I would have expected, it got me thinking of the limitations I mentioned. I put together this alternative quickly that circumvents most of those limitations.
Basically, that ${test_counter} field is the trigger. Just decide what you want a "complete" record to look like and set the logic up according to that. That means you can have required fields!
Hello @jcarlson and @abureaux and thanks for all your help !
I tried to get either, and even a combination, of your solutions to work for me but I kept getting strange results. I almost gave up and then I tried this solution:
1) Added once(count(${test_rpt})+1) to the repeat_count column of begin repeat record
2) Added allowAdds=true allowUpdates=false query to the bind::esri:parameters column of begin repeat record
This solution produced the following:
1) After loading the survey from the INBOX, 1 additional repeat record (editable since allowAdds=true), was added.
2) It also loads any previous repeat records (read-only since allowUpdates=false query)
3) If I try to save the survey it notifies that I have a required field in the editable repeat record; which is correct.
4) After populating this one and only required field in the repeat, I am able to submit the survey
This creates no blank repeat recs and also allows me to have required fields in the repeat.
I've tested this but not exhaustively. I wonder if there is something you would expect to find given this solution (that perhaps I have not yet found)?
One thing I noticed that is odd (and I cannot explain) is that IF the parent record has zero associated repeat recs, it automatically creates 2 repeat records the first time. BUT after at least one repeat records exists for a given parent record, it only creates 1 additional repeat record when opening.
The other smallish thing is that the repeat that is displayed when the survey is opened is the first repeat created, followed by the next and so on. To get to the repeat that the user needs to update, they have to click through as many repeat recs as exist. I realize they can long click on the right arrow to go to the end of the repeat collection, but this is not obvious. I'm hoping that there might be a way to use position(..) and/or index to have the survey open to the last (most recent) repeat record.
Finally one other small thing that I do not understand, is that the user is NOT able to delete the newly created repeat record even though the allowAdds=true. This I'm quite happy about but wasn't expecting it.
Thanks again and I look forward to any further input / advice you might have.
Cheers, BKS
Sounds like you have a good solution there! If you have no more questions, don't forget to mark your response as the accepted solution so others can benefit.
"...IF the parent record has zero associated repeat recs, it automatically creates 2 repeat records the first time..."
Sounds like you need to beef up your calculate a little. On that note, two things:
"I'm hoping that there might be a way to use position(..) and/or index to have the survey open to the last (most recent) repeat record."
This is a common ask. Unfortunately, the answer is "cannot be done" (at least presently).
"...the user is NOT able to delete the newly created repeat record..."
This is expected behaviour. As soon as you use the repeat_count column, the option to add or delete records goes away.