I have been having troubles getting nested repeats to work properly. When I used a label on the inner repeat based on the position of the outer repeat (ie concat(‘id’, ‘-’, position(…)), I found the labels changed in strange and unpredictable ways. I dropped the labels and set a fixed repeat_count for each repeat which appeared to be working but now I see the data being returned by the nested repeat is incorrect.
It is associating the data from the 3rd nested repeat with the 1st nested repeat. See the json data below. ‘add_sapling_num’ sets the following ‘newSapInfoRpt_count’ and is used for the repeat_count of the subsequent ‘newSapInfoRpt’. Note the first group (CTFHM_10-1) has those set to 0, and therefore there is no repeat appearing on the form and no data entered there. But, for the 3rd group (CTFHM_10-3), they are = 1, The 3rd repeat was shown on the form and that is where the ‘SaplingID’ data was filled in as shown by the user. (Note: The values ‘new_sapling_addReason’: new and “new_SaplingDistanceMethod”: “h” are defaults and therefore appear in each ‘newSapInfoRpt’ regardless of whether the repeat is shown on the form.)
So, this seems scarily incorrect. Why is the data getting associated to a different repeat instance?
sapGrp.xml (2.8 KB)