Xpath evaluation : type mismatch value

Bonjour à toute la communauté
Je rencontre une erreur depuis lors tu test de mon formulaire. Lorsque j’essaie de faire un saut de question pour une question d’au autre groupe, je recois un message d’erreur intitulé :
Xpath evaluation: type mismatch value 1 2 3 4 5 6 7 could not be loaded into question null. Check to see if value 1 2 3 4 5 6 7 is a valid option for question null
Quelqu’un pourrait m’aider s’il vous plait ?
DS RVC.xlsx (93.9 KB)

Bonsoir @Rildwan,
The related choice_list (viplace) only has items up to 6.
Furthermore, at several places, you use calculations like once(“1 2 3 4 5 6 7”) together with constraints like .>=7. This is contradictory. This calculation cannot fulfill your constraint. The value of PLACE0 for example is set to “1 2 3 4 5 6 7” (multiple select).

Side-note: Be aware that normal calculations are redone every time a form is saved/opened. So, in case you need to edit submissions later your original age calculation round(((today()-${DOB}) div 365),0) may change. You might use once here or the metadata today - which doesn’t change, different to the today() function…

1 Like

merci beaucoup @wroos pour votre prompt réponse, j’ai supprimé tous les calculs de once("1 2 . . . . . “) de tout le formulaire et je n’ai plus eu ce problème.
Mais pourrez-vous m’aider alors avec une méthode qui présélectionne par défaut toutes les réponses de ma sélection multiple à la place de once (” ")?

You can use your once. But you need to correct your constraint, in any case. The value of a select_multiple is a string of the choice names (codes) separated by one blank. So, a constraint like .> 7 doesn’t make sense for select_multiple… It will only allow selects with “7 …” and following higher codes. What do you want to control here? If it is the minimal number of selects, you would need to use count-selected(…)… See
http://getodk.github.io/xforms-spec/#fn:count-selected
Side-note: I would like to recommend testing a structure/pattern (e.g. your select_multiple with calculation and constraint) you use in development before applying it in the whole form.

1 Like

Exactly, I wanted to control the minimum number of selections by using this constraint.
Once again, thank you for your recommendations @wroos

1 Like