Kobo Form Deployment error

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)

Hi @ryanend,

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

4 Likes

Hi @ryanend,

You need to use jr:choice-name(${question}, ‘${question}’) and it will work fine. I hope it will be rectified in official documentation.

Thanks

3 Likes

Hi @ntiwari,

Welcome to the community! Thank you for bringing this to our attention. We shall definitely update the same in our support articles too.

Have a great day!

1 Like

P.S. The support article still hasn’t been updated.
BTW, strangely, it works fine without the apostrophe in preview mode, but won’t let me deploy.

Hi @nartabaza
Having had a look at the discussion on forum

I would like to ask additional questions:

  1. Do you have this question within a repeat group?
  2. When you use the apostrophe,
  • Does it deploy?
  • Does it also preview?
    -Does it work on Collect?
    -Does it work on Enketo?

Using this without the apostrophe should not be working on preview, and thus this could be a potential bug.

Stephane

Yes, it is in a repeat group.
I’ve just tested it again. It works in preview as a draft, but won’t let me deploy it.

Since it’s not deploying without the apostrophe, I didn’t get to test it on Collect.

Here’s my xls file if that helps you.
360 evaluation.xlsx (12.9 KB)