I’m building a form to conduct facility/school assessments. At the beginning I’m asking for the name of the facility (text entry) and lower in the form I have a repeating group where information on individual buildings at the facility can be detailed. So respondents can add as many buildings as they need.
For each building (or group) I want to include the name of the facility to which it belongs (I know this is indexed, but it makes working with the data afterwards more intuitive). The way I have set it up is with a hidden question inside the repeating group, for which the default response references back to the response given to the facility name question with the ${facility_name} code.
For some reason, the first entry of this group doesn’t store the referenced facility name, but the second added and subsequent groups do and it works great from there on. But the response of the hidden question of the very first group is always blank. Same behaviour if it’s not a hidden field.
Hi Kal_Lam, thanks for reaching out. Below is a link to the xlsform. The “facility_name” field is one of the very first and the repeating group is the one called " Building information". For debugging purposes I added a text field to inject the previous answer, but it’s the hidden field at the beginning of this group that I need to get working correctly.
Hi @Margoye, this does seem to be a potential bug — thanks for bringing this to our attention. Can you try doing to following to get your desired result as a workaround:
The calculate type calculates text but calculations can also be added to any other question types. Non-text types can be useful for data analysis, e.g if a date or date-time is calculated. If no label and no hint is included, the calculation will be hidden.
You can also add a default calculation, which will only be calculated only once when the form loads or - if the question is inside a repeat - when the repeat is added.
This explains why the first instance of the repeat does not populate the default value — as it wasn’t accessible on the initial form load — and why subsequent repeats do have access to it. So in the future, rather use the approach I suggested above.