Previous response pre-loaded for the same question, from a previous iteration of a repeat

1. What is the problem? Be very detailed.

Hi everyone,

I searched but didn't find any solution to my problem (perhaps it is yet impossible ?), I want to be able to have a list of the previous answers to choose from when I click in question to fill (type = text) or to have the select-one pre-selected, based on the same questions previously answered in a previous iteration of the same repeat

here is my form :

formulaire_sicen_v4.xlsx (35.6 KB)

formulaire_sicen_v4.xml (28.9 KB)

I need this for the question regne and recherche_espece and nom_espece

If it's possible, it will save quit a time for technician in the field when they encounter redundant species

thanks in advance for your help !

Unfortunately, although this is technically possible, currently ODK javaRosa validate check will throw a (bogus) cyclic dependency error whenever you reference the same question from a previous iteration, even though strictly speaking it is not self referencing (see https://github.com/opendatakit/javarosa/issues/440). And although Enketo doesn't suffer this problem, Enketo has got a different bug that causes indexed-repeat() to fail when referencing any question from within the same repeat (see https://github.com/enketo/enketo-core/issues/548)

So, unfortunately, the neato XLSForm solution I wrote for you the other day wont work till these are fixed. Sorry :man_facepalming:

2 Likes

OK thanks for the answer Xiphware !

I came across this again through search. We still haven't made a decision on the self-referencing question in JavaRosa.

However, dynamic defaults have now been added and remove the need for the self-reference in @Xiphware's form when using a value from the last repeat instance as a default in the new instance. You may be interested in an XPath-based solution that I shared at Error dialog when downloading form with last-saved - #4 by LN. It should be possible to write the same with indexed-repeat.

Hi @LN,
I think @Jeanb is far from France this year.
Thanks for your answer and for the "suivi" !
I'll try to implement this in our 2020 form version.

1 Like