In my ODK form I have a number of groups nested inside bigger groups. In them there are certain repeatable groups which do not show on the list but only appear when I enter values. How can I make Repeatable groups show in group lists even when there is no data added?
In ODK forms, groups that can be repeated don't appear in the group lists until you add data. This is on purpose to keep things neat and make it easier for users.
But if you want these repeatable groups to show up in the group lists even when there's no data, there's a trick you can try.
You can put a hidden "dummy" field inside the repeatable group and give it a default value. This will make the repeatable group show up in the form, even if it doesn't have any information in it.
"Hidden" means which types here, please? calculate or/and hidden type?
Hint: As far as I understand, this workaround will create one repeat case (only with the dummy value filled). I am afraid, this approach may cause some problems, esp.
- References to the repeat group, like count(), indexed-repeat, will already count the (dummy) case.
- If the repeat contains mandatory fields, errors will result on checks, and you would need to delete or complete this repeat to be able to finalise.
- Without mandatory fields, you may get reoeat cases only with this dummy value which need to be removed before analysis.
Can you share a related extract of your form (as XLSForm), please?
With normal dynamic repeats, the repeat group is shown in the navigation menu, even before you enter data. (A first empty repeat seems initalised automatically). This is probably different, if they are filtered by a dynamic repeat_count or a relevant clause. Do you use repeat_count or relevant here?
To fix this issue, you can use the field-list and table-list workaround instead of using the hidden type.
If you want a group to always show up in the list, even when there's no data, adjust the appearance attribute.
The important thing here is the appearance attribute for the repeatable group (repeat_group). By setting it to table-list, you're saying that this group should be visible in the list, even if it's empty.
Just make sure your ODK Collect version supports this feature, as older versions might not support appearances.
Check the attached xlsform for better understanding.
You're right about using the table-list appearance in ODK Collect to display questions in a table-like format within a repeat group or related questions.
Sometimes, I've used table-list to make repeatable groups show in the group list even when there's no data added. But I want to clarify, this is more of a workaround. You should decide if this approach works for your needs.
As far as I know, there isn't a built-in way to directly display repeatable groups in the group list without any data added. I hope this helps clarify things. Thank you!
Hi @Joseph_Muganga,
Maybe I missed something. As far as I can see, nothing will change, if I remove the table-list appearance.
Would you mind to test an adapted example again, please? test02.xlsx (10.0 KB)
If you only have one question in a repeat group, removing the table-list appearance might not show a noticeable change. However, when you have multiple questions, using table-list will display all of those questions, even if there's no data entered for them.
Here's an extra tip:
field-list: It shows questions in a list, one after another, in a straight line.
table-list: It organizes questions in a grid-like format, allowing users to input data across rows and columns, making it structured.
I've attached an xlsform to demonstrate this. Give it a try, and hopefully, it will help clarify your point. test02.xlsx (10.1 KB)