why the question ID in a loop is not displayed in the case management? I have searched but it does not display when you search in the question. question ID outside of this loop there is no problem.
Case management can only save individual values as case properties. With loops, there can be a new value for each time through the loop, so it doesn't know what to save. There are two ways around this.
The first is to add a hidden value outside the repeat group to calculate the value you want to save as a case property. For example, you may want to join all values for a question in the repeat group using the
join function. This will create a single string containing all of the entered values. That can then be saved as a case property.
The second option is using child cases as described here
thank you very much,
but can you please explain more how to use this join function. I have checked but I don't know what I should put in join(", ", /data/my_repeat/child_name).
I have two loop levels:
the idea is that when the number of villages = 2
he repeats the questions twice during the recording
In addition, for each village, there will be 2 different people.
Thank you so much for your generosity!!!
It should work the same with two loop levels, actually. Let's say there are two villages, with two people in each. Then you can make a hidden value using the join expression to assemble a list of all four names. This should be outside both repeat groups. The calculate expression for the hidden value should look like:
join(", ", QUESTION)
And there you can drag and drop the "name" question where I typed
it worked fine thanks but i have another problem with the default value.
In fact, I have a multiple choice type question the name of csb which has several villages and I would like the value to select in the registration form to be displayed as the default value in the modification form.
I used the join function like this join(',',multiple choice1,multiple choice2,multiple choice...) in a hidden value but it doesn't work.
In other words, I would like to retrieve the value selected in the registration form and set it as the default value in the modification form. I have already configured with the case management parameters...
Thanks a lot !
Is this a correct explanation of what you're trying to set up?
- Form 1 has a repeat group to loop over each village
- Form 2 also has a repeat group that loops over each village
- You want to use the values collected in form 1 as default values for a question in the repeat group for form 2
You're probably best off using child cases for each village repeat group, especially if you'll be saving more information about them. That'd also probably be useful in reports and data exports, so you can view all the information about villages with one row per village.
That said, you can kind of do what you describe, though it's complicated. If you use spaces to separate each of those values, you can use the multi-select helper functions and sequence functions on the result as if it were itself a repeat group. However this will only work if those values themselves do not have spaces. This is how you can access the value from each iteration of the repeat group:
That is, if
STORED_VALUES is the set of values from form 1 joined together with
" ", then you can put this in a hidden value in the repeat group in form 2.
position(..) will give you the iteration number (
1 the first time through, then
2, and so on).
selected-at will then select that numbered element from
STORED_VALUES. This is pretty tricky to get right though.