Calculate expression evaluates to 'false'

I would greatly appreciate some help fixing the following expression:

calculate="if(selected(${c5a},'0'), ${c5a1}, ${c5a2})"

The variable c5a asks the user whether they want to scan a participant ID using the barcode scanner (0) or enter it manually (1). c5a1 is the barcode variable and c5a2 is a text variable. Currently, the expression evaluates to 'false' whereas I want it to return the value of either c5a1 or c5a2.

Is this possible? Is there a better way to do it?

Thanks in advance!

Hi Lauren,

There's nothing obviously wrong with your calculate, so for issues
like these, it's important to break the form down and take things step
by step.

I've recreated what you described and attached the form. It works for
me on the latest build of Collect. Compare it to your form and go from
there.

Yaw

barcode.xlsx (10.9 KB)

ยทยทยท -- Need ODK consultants? Nafundi provides form design, server setup, in-field training, and software development for ODK. Go to https://nafundi.com to get started.

On Fri, Sep 9, 2016 at 7:00 PM, laurenzalla@gmail.com wrote:

I would greatly appreciate some help fixing the following expression:

calculate="if(selected(${c5a},'0'), ${c5a1}, ${c5a2})"

The variable c5a asks the user whether they want to scan a participant ID using the barcode scanner (0) or enter it manually (1). c5a1 is the barcode variable and c5a2 is a text variable. Currently, the expression evaluates to 'false' whereas I want it to return the value of either c5a1 or c5a2.

Is this possible? Is there a better way to do it?

Thanks in advance!

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.