I am trying to fetch the label name of the option selected using jr:choice-name() function. But some how I see an error message once the form get updated in enketo - “FormLogicError: Could not evaluate: if( /model/instance[1]/aGx9ykmJP6iFxDeuog56uF/C1 =01, “”, jr:choice-name( /model/instance[1]/aGx9ykmJP6iFxDeuog56uF/C2 ,’ /aGx9ykmJP6iFxDeuog56uF/C2 ')), message: Function “{http://openrosa.org/javarosa}choice-name” does not exist.”
Consider an example - where you have set of single select questions
Question : C1
Option 1 – 01
Option 2 – 02
Question : C2
Option 3 – 03
Option 4 – 04
Question : C3
Option 5 – 05
Option 6 – 06
In the calculate field if I use if(${C1}=01, jr:choice-name(${C2},'${C2}'), jr:choice-name(${C3},'${C3}') ). This is to get label of C2 if C1 is ‘01’ else get the label of C3. This is not working in kobo.
The expression ` if(${C1}=01, jr:choice-name(${C2},’${C2}’), ${C3} ) works - But in this case I am not able to fetch the label of C3 question.
some further experiments and a hackish work-around:
applying the patch referenced above did not seem to work nicely. I could not find instructions on how to patch a file and deploy it, ran into quite few issues.
Seems like it was committed in github, i followed the kobotoolbox docker images (on hub.docker.com) and realized that there were recent versions of enkety, i cho_express
Specifically, i changed the docker compose file to:
from a larger perspective, it does not seem right that for C1/C2/C3 you are storing values, but for C4/C5/C6 you want to store labels. It might be useful to be consistent across the entire form
lobo
···
On Thursday, March 15, 2018 at 1:25:22 PM UTC-7, Donald Lobo wrote:
Hey Amar
Seems highly likely that it is this issue:
On Friday, March 16, 2018 at 7:07:38 AM UTC+5:30, Donald Lobo wrote:
hey amar:
some further experiments and a hackish work-around:
applying the patch referenced above did not seem to work nicely. I could not find instructions on how to patch a file and deploy it, ran into quite few issues.
Seems like it was committed in github, i followed the kobotoolbox docker images (on hub.docker.com) and realized that there were recent versions of enkety, i cho_express
Specifically, i changed the docker compose file to:
from a larger perspective, it does not seem right that for C1/C2/C3 you are storing values, but for C4/C5/C6 you want to store labels. It might be useful to be consistent across the entire form
lobo
On Thursday, March 15, 2018 at 1:25:22 PM UTC-7, Donald Lobo wrote:
Hey Amar
Seems highly likely that it is this issue: