Multiple logical conditions in a single calculation

Please forgive the newbie question.

I am trying to write a calculate command that combines the value of one
variable, say x1, with the minimum value of four other variables--x2, x3,
x4, x5.

All of these variables can take on one of five values.

Depending on the specific value of x1 and the specific value of the minimum
of the other four, a number should be produced. I need to specify that
number for each possible combination of x1 and the min of x2-x4.

I'm currently working with something that looks like this:

if(${x1}=0 & min(${x2},${x3},${x4},${x5})=0, '50')
if(${x1}=10 & min(${x2},${x3},${x4},${x5})=0, '40')

and so on.

How can I combine all these together into one properly formed command to
calculate?

Thanks in advance for your generous help.

Hi Yaniv,

min can only take a single parameter, so you'll have to combine x2-x5
into a temp variable first. $temp's calculate would be something like
concat(${x2}, " ", ${x3}, " ", ${x4}, " ", ${x5}). Then you can and
the two values.

I wouldn't combine these into one command. Use a series of temp values
to build up the final answer. Using this step-by-step approach makes
your form easier to test and ensure it will run quickly on all
devices.

Yaw

ยทยทยท -- 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 Thu, Dec 17, 2015 at 8:14 PM, yaniv.stopnitzky@gmail.com wrote:

Please forgive the newbie question.

I am trying to write a calculate command that combines the value of one
variable, say x1, with the minimum value of four other variables--x2, x3,
x4, x5.

All of these variables can take on one of five values.

Depending on the specific value of x1 and the specific value of the minimum
of the other four, a number should be produced. I need to specify that
number for each possible combination of x1 and the min of x2-x4.

I'm currently working with something that looks like this:

if(${x1}=0 & min(${x2},${x3},${x4},${x5})=0, '50')
if(${x1}=10 & min(${x2},${x3},${x4},${x5})=0, '40')

and so on.

How can I combine all these together into one properly formed command to
calculate?

Thanks in advance for your generous help.

--

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.