Do you have a workaround on how to use a previous value of a variable within a repeat group in another variable in the repeat group without having a circular reference error? For example my user is supposed to enter a number of foods with different time of consumption but we also want to have the option to select type = same as previous. But when I'm trying to use the time[x] = time[x-1]
where x
is the current position I have circular reference error.
Use previous value within a repeat group
commcare
Related Topic
- CommCare – How to Use Text Formatting in Hidden Values
- CommCare – Default Value for Multiple Select Question
- Get total parent-cases with at least one sub-case with a particular value
- Displayed label for repeat group
- CommCare – How to Join Multi-Select Lookup Table Values with Commas in a Label
- How to count answers to a question in a repeat group in CommCare
- Can you create child cases from a repeat group in advanced modules in CommCare
- Display condition error in repeat group controlled by user-input question
Best Answer
I would need a bit more information about your configuration to properly design a solution, but I would suggest examining the following document on repeat groups. In particular, I would examine the sections on the
..
,current()
andposition()
functions. These are three functions used specifically for repeat groups that allow you to reference specific nodes that have been created by a repeat group. Based on your description, you could potentially use a combination of thecurrent()
function and theposition()
function to bypass this circular reference error. I hope this helps!