Dear All,
Pls help...
I have create a form and using begin repeat function, In begin repeat there is begin repeat but it is not working, pls suggest how I use begin repeat in begin repeat.
Regards
Sajid Akhter
Dear All,
Pls help...
I have create a form and using begin repeat function, In begin repeat there is begin repeat but it is not working, pls suggest how I use begin repeat in begin repeat.
Regards
Sajid Akhter
Dear Grzesiek
Thanks for reply.
Pls download the file from given below mentioned link, first loop is working perfectly but in second loop it give error.
Regards
Sajid
Dear Arif,
Thanks for your prompt response, i have upload the same form when second loop is start and reached to question no 213B it give error, pls download the error from mentioned below link.
https://drive.google.com/open?id=1XHUKBf_AZKxMzNO9sb72OrdPqFDTwu4W
Regards
Sajid
can you please check it with the latest version of ODk collect. I have checked with Kobo collect and ODK collect both are fine to generate the desired repeat. Do not show this error you mentioned.
Dear Arif,
I am using ODK collect v1.8.1, still I am getting the same error, first loop is working fine when the second repeat come it start fine but when it reach to 213B, it give error message, when I press ok it will move.
https://drive.google.com/open?id=1XHUKBf_AZKxMzNO9sb72OrdPqFDTwu4W
Regards
Sajid
In your case probably you need to use the index-repeating formula in the form or change the collect version (ODK collect version 1.12.2 is available in the play store). I do not which one is applicable to your current situation.
@sajidakhter
It's logical to me that it doesn't work and I'll try to explain why:
As you know and as you said you have two repeated groups and they are nested (one inside another).
You try this:
indexed-repeat(${Q213B}, ${Repeat213b_f}, position(..))=1
where the first parameter ${Q213B}
is a single choice question, the second parameter ${Repeat213b_f
} is a group (which is inside another repeat group) and the last one position(..)
is a position - number of group you pass as a second parameter.
So if position is 1 you refer to ${Repeat213b_f}[1]
if it's 2 you refer to ${Repeat213b_f}[2]
etc.
The problem here is that ${Repeat213b_f}
is inside another repeat group so we know which number of ${Repeat213b_f}
you want but we don't know the number of the second group.
I tried this instead: indexed-repeat(${Q213B}, indexed-repeat(${Repeat213b_f}, ${Repeat_room_No}, ${calc1}), ${calc2})=1
where I calc positions bor both groups, but I can't convert such a form so I don't know maybe I do that in a wrong way or we don't support such a case.
@yanokwa @LN maybe you can help?
Regards,
Grzegorz
You can see at https://opendatakit.github.io/xforms-spec/#fn:indexed-repeat that the function description is indexed-repeat(nodeset arg, nodeset repeat1, int index1, [nodeset repeatN, int indexN]{0,2})
. This is a little confusing but what it means is that to go multiple levels deep you can add more parameters.
Say you have a repeat called friends
with a nested repeat called pets
and that you want to get the name of your 3rd friend's 4th pet, you could use an expression like indexed-repeat(${pet_name}, ${pets}, 4, ${friends}, 3)
Here is a form that illustrates this.
Hi @Grzesiek2010,
are you aware if in the meanwhile something got broken in the function position(..).
If I use the form posted by @LN it works for the first iteration of the repeat "friends".
All works well and the pet_count has a value.
If I add a second "friends" then when I get to "pets" the pet_count is not evaluated (empty or null).
If you test the form nested-indexed-repeat you can verify it.
Ok. Just realized that it's working in collect.
It was the Enketo preview not working.
Hi LN,
I think my current issue is also very similar with this thread. Is it possible to access nested repeat value from another nested repeat? Here, in you example xlsform of nested indexed-repeat, you are accessing nested repeat value from outside repeat group so far.
Would be grateful to your attention.
Thanks,
Raj Pravat