Constraint for string based on previous question instead of using relevant

Hi all,
I would like to ask a question (yes or no) and then if yes - require
answers (something entered) to subsequent string question, if no - dont
allow anything to be entered in the subsequent string question.
I know I can hide/skip using "relevant" but i want to keep the questions
on the same page so I hope to find a a way to use "constraint".
Could anyone feeling generous hint at what the constraint might look like
for if variablea is yes -- require answer to next question, if variablea is
no -- dont allow an answer to the next question ?
Many thanks!
Bill

You would have to have two conditions, required, and constraint

required = "selected(${yq_q},'yes')" -- to make sure that the question
is answered if it is yes
constraint = "if( selected(${yn_q},'yes'),string-length(.) > 0,
string-length(.) = 0)" -- if the answer is yes, we have an
non-zero-length answer, otherwise, we have a zero-length answer

··· On Wed, Jun 5, 2013 at 3:42 PM, Bill Olander wrote:

Hi all,
I would like to ask a question (yes or no) and then if yes - require
answers (something entered) to subsequent string question, if no - dont
allow anything to be entered in the subsequent string question.
I know I can hide/skip using "relevant" but i want to keep the questions
on the same page so I hope to find a a way to use "constraint".
Could anyone feeling generous hint at what the constraint might look
like for if variablea is yes -- require answer to next question, if
variablea is no -- dont allow an answer to the next question ?
Many thanks!
Bill

--

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/groups/opt_out.

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

I would like to do the same thing but am using the xls form as I am not a
programer. Are the two conditions entered in the same form using the xls
development path?
Thank you,
Sarah

··· On Wednesday, 5 June 2013 15:42:11 UTC-7, Bill Olander wrote: > > Hi all, > I would like to ask a question (yes or no) and then if yes - require > answers (something entered) to subsequent string question, if no - dont > allow anything to be entered in the subsequent string question. > I know I can hide/skip using "relevant" but i want to keep the questions > on the same page so I hope to find a a way to use "constraint". > Could anyone feeling generous hint at what the constraint might look > like for if variablea is yes -- require answer to next question, if > variablea is no -- dont allow an answer to the next question ? > Many thanks! > Bill >

thanks mitch!

··· On Wednesday, June 5, 2013 11:23:50 PM UTC, Mitch Sundt wrote: > > You would have to have two conditions, required, and constraint > > required = "selected(${yq_q},'yes')" -- to make sure that the question > is answered if it is yes > constraint = "if( selected(${yn_q},'yes'),string-length(.) > 0, > string-length(.) = 0)" -- if the answer is yes, we have an > non-zero-length answer, otherwise, we have a zero-length answer > > > > > On Wed, Jun 5, 2013 at 3:42 PM, Bill Olander <billyo...@gmail.com wrote: > >> Hi all, >> I would like to ask a question (yes or no) and then if yes - require >> answers (something entered) to subsequent string question, if no - dont >> allow anything to be entered in the subsequent string question. >> I know I can hide/skip using "relevant" but i want to keep the >> questions on the same page so I hope to find a a way to use "constraint". >> Could anyone feeling generous hint at what the constraint might look >> like for if variablea is yes -- require answer to next question, if >> variablea is no -- dont allow an answer to the next question ? >> Many thanks! >> Bill >> >> -- >> -- >> Post: opend...@googlegroups.com >> Unsubscribe: opendatakit...@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...@googlegroups.com . >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > > > -- > Mitch Sundt > Software Engineer > University of Washington > mitche...@gmail.com >

Hi Sarah,

Yes, those expressions are the ones for .xls format (because they use the
${fieldname} syntax to refer to fields). You just put the expressions into
the required and constraint columns of your worksheet.

Best,

Chris

··· On Thu, Jun 13, 2013 at 1:56 AM, Sarah Pfeil wrote:

I would like to do the same thing but am using the xls form as I am not a
programer. Are the two conditions entered in the same form using the xls
development path?
Thank you,
Sarah

On Wednesday, 5 June 2013 15:42:11 UTC-7, Bill Olander wrote:

Hi all,
I would like to ask a question (yes or no) and then if yes - require
answers (something entered) to subsequent string question, if no - dont
allow anything to be entered in the subsequent string question.
I know I can hide/skip using "relevant" but i want to keep the
questions on the same page so I hope to find a a way to use "constraint".
Could anyone feeling generous hint at what the constraint might look
like for if variablea is yes -- require answer to next question, if
variablea is no -- dont allow an answer to the next question ?
Many thanks!
Bill

--

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/groups/opt_out.