Relevant with if statement

Hi

I am quite new to xlsform and I want to know how to use "if" statement
within relevant. Let assume that that I have a select one variable
"Crop_system" with choices 1: Pure and 2: Mixed. I have another integer
variable "Crop_Num" and I want to populate the field with the number of
crops within a plot. I want to limit the number of crops to 1 if for
"Crop_system" variable the selected choice is "1" and set the maximum
number of crops to 8 if the "Crop_system" is "2"

Any help is highly appreciated

Hi, Florent.
Try the xlsForm in attach.
If eventually, your goal is to set at 1 and 8 respectively crop_num, we
won't need crop_num1 and crop_num2 fields, and then, the calculation would
be if(selected(${crop_system},'1'),1,8).
Hope that will help.
Best,
Note(to all):
Any most fast way to do this will be welcome and well appreciated.
In advance, thanks.

Florent_Crop.xlsx (10.7 KB)

··· Le mardi 14 février 2017 15:23:49 UTC+1, Bigirimana Florent a écrit : > > Hi > > I am quite new to xlsform and I want to know how to use "if" statement > within relevant. Let assume that that I have a select one variable > "Crop_system" with choices 1: Pure and 2: Mixed. I have another integer > variable "Crop_Num" and I want to populate the field with the number of > crops within a plot. I want to limit the number of crops to 1 if for > "Crop_system" variable the selected choice is "1" and set the maximum > number of crops to 8 if the "Crop_system" is "2" > > Any help is highly appreciated > >

Dear Amal,

Thanks for your Idea, It is working now

Best

··· On 14 February 2017 at 18:07, Amal wrote:

Hi, Florent.
Try the xlsForm in attach.
If eventually, your goal is to set at 1 and 8 respectively crop_num, we
won't need crop_num1 and crop_num2 fields, and then, the calculation would
be if(selected(${crop_system},'1'),1,8).
Hope that will help.
Best,
Note(to all):
Any most fast way to do this will be welcome and well appreciated.
In advance, thanks.

Le mardi 14 février 2017 15:23:49 UTC+1, Bigirimana Florent a écrit :

Hi

I am quite new to xlsform and I want to know how to use "if" statement
within relevant. Let assume that that I have a select one variable
"Crop_system" with choices 1: Pure and 2: Mixed. I have another integer
variable "Crop_Num" and I want to populate the field with the number of
crops within a plot. I want to limit the number of crops to 1 if for
"Crop_system" variable the selected choice is "1" and set the maximum
number of crops to 8 if the "Crop_system" is "2"

Any help is highly appreciated

--
--
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 a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/opendatakit/6a4yVImOL3g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
BIGIRIMANA Florent
GIS Specialist
National Institute of Statistics of Rwanda
AV de la Justice/Muhima
Kigali/Rwanda
Tél 0788748944/0728748944