Hi All,
I am using “jr:choice-name(${question}, ${question})” in calculate question type to get the selected choice label. I am referring to this(https://support.kobotoolbox.org/responses_inside_question.html) documentation. It works fine in preview, but I am not able to deploy the Kobo form. I researched but failed to get a solution for this. I am attaching a sample excel(xls) file for replicating the issue.
The error which I receive is:
unable to deploy
your form cannot be deployed because it contains errors:
ODK Validate Errors: >> Something broke the parser. See above for a hint. Error evaluating field ‘calculation_fruits’: error in evaluation of xpath function [choice-name] => org.javarosa.xpath.XPathException[XPath evaluation: Parse error in XPath path: []. Bad node: org.javarosa.xpath.parser.ast.ASTNodeAbstractExpr@de0a01f] Caused by: org.javarosa.core.log.WrappedException: error in evaluation of xpath function [choice-name] => org.javarosa.xpath.XPathException[XPath evaluation: Parse error in XPath path: []. Bad node: org.javarosa.xpath.parser.ast.ASTNodeAbstractExpr@de0a01f] … 10 more Result: Invalid
Thanks in advance. The sample data to reproduce issue ->Choice-name_Test.xlsx (10.2 KB)
Your issue is a quit simple as you have to add an apostrophe to your formula like this: jr:choice-name(${fruits}, ‘${fruits}’) Choice-name_Test.xlsx (10.2 KB)
Let me know the result.
Best,
Yasser