I face a problem I can't resolve.
We drive a field servey of plants species inventory. Species list are different from on site to another (I use choice filter to manage it).
For the moment I builded my form in a non generic, hard to modify way : -> A select widget for the abundance of each species
Reading yesterday some great recipes on the forum, I tried and I achieved to merge two great ones from @LN and @jules_rugwiro :
and
So my colleagues can now loop in the species list until the select 'no more species' AND the previously select species get out of the list, so the can not count the same species two times.
This works really fine.
But when I try it I get a error from xlsformonline:
Error: ODK Validate Errors:
Something broke the parser. See above for a hint.
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
The following files failed validation:
${indefinite_repeat_and_remove_already_selected_from_species_list}.xml
Result: Invalid
I do not have any idea about the reason but I am not an xlsform guru
I haven’t had a chance to look at your form yet but I’m guessing that you are trying to do this in a nested repeat, is that right? If so, you are running into a Collect bug that we hope to publish a fix for this week.
Yes exactly A first repeat of geopoint and inside an infinite repeat for species.
Great to ear that it will probably work !
Now I remember I red something about this bug... but I am not sure... This will be a very useful form for us.
Quick update here. We ended up doing a Collect point release without this fix because I noticed some problems with it and was pulled into other time-sensitive work. I hope to get back to it by the end of the week.
Collect v1.26.3 is now out and should fix this issue.
However, I have since realized that the sample form can cause an infinite loop in Collect when using the hierarchy view or finalizing. To avoid this, you can change the count expression to add a check for blank values: ${count} = 0 or (${taxons_observes}[position()=${count}]/espece != '' and ${taxons_observes}[position()=${count}]/espece != 'maille_suivante'). I have updated the original sample form accordingly. Please give it a try and let us know how it works for you, @mathieubossaert!
Do you remember when I said that there was a change needed to the form design to make sure there wasn't an infinite loop on finalization? I sent you the converted form without making that change. So sorry about that.
I am facing a problem with this form. I am preparing the 2022 field season and I would like to use this generic form, as the number of species and sites is now too big to use a none generic way.
On the collect side, the form is well finalized at the end of data collection (as I said in the last message).
I try it today and go forward with submissions. And I realize that species code (select_one especes) is empty.
I can't understand why so I think it could be a bug ?
It is quite weird, when I add a calculate field containing ${espece} this calculation is ok and this field is well submitted to Central, but select_one still empty.
Hi !
I found another solution to do that trick ! The main idea is to concat the current choice (Q1) with an unique id (position(..)) (Q0) in order to compare the current selection of a repeat group and the other ones (C1). The choice_filter exludes the current selection (Q1) from the list (C1) with the functions substring-before and substring-after. Then, it only check if the name was already selected or not.
By using the functions substring-before and substring-after, we are able to edit previous selections without any duplication.
This is the trick (working on Kobo Collect and Enketo) :
Hi,
The previous solution worked only for name values with the same length or really differents (for example the values "on" and "one" would not have worked). This another version is working with a concatenation of a special character ('#' in red). It's not exhaustive but for me... it's enough ! You can of course extand the character with a unique sequence ('#$^%ù~ [...] +=').
Thanks @willydauphin and welcome to the ODK community forum ! When you get a chance, please take some time to introduce yourself here
Thanks for sharing, I will try it with Collect. Lazy question : could you share an xlsform ?
You might take a look at this discussion and the proposed trick
Unfortunately, I'm wondering if it's possible to limit the number of repetitions. With the second form, I only fix the number of repetitions. I would like to have someting like '.<${Q1_length}' but it looks like impossible or seems to be a very bad way. Any idea ?