Regular Expression - Calculation - Boolean

Hello,
We have 2 step process.

First step person scan a QR Code.
e.g
AB123_BLD123
or
AB123_ORL123

Where BLD = Blood and ORL == Oral fluid

Then we want to display to the user what type of sample they just scanned.

We tried a calculate using:
if(regex(${samplecode},'BLD'), 'blood', 'not_blood')

but doesn't work - just gives not_blood even when the entered value does contain the BLD string.

Thoughts welcomed!

Michael

See https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

You likely need

'.BLD.'

ยทยทยท On Fri, Feb 5, 2016 at 5:50 AM, wrote:

Hello,
We have 2 step process.

First step person scan a QR Code.
e.g
AB123_BLD123
or
AB123_ORL123

Where BLD = Blood and ORL == Oral fluid

Then we want to display to the user what type of sample they just scanned.

We tried a calculate using:
if(regex(${samplecode},'BLD'), 'blood', 'not_blood')

but doesn't work - just gives not_blood even when the entered value does
contain the BLD string.

Thoughts welcomed!

Michael

--

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.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com