Multiple Constraints

Essentially what I want to do is test an age variable against the
variable defining the interviewee's relationship to the household
head. If the interviewee is too young to have this type of
relationship to the household head, I want a message to pop up stating
so. I believe this would require me to program in multiple constraints
for the same variable. I've tried listing the constraints on separate
lines, and although ODK collect will allow me to view the survey the
constraints don't work as programmed. I've tried combining them in a
single line of code and I get an error in validate that I have already
defined the constraint. Has anyone programmed in multiple/complex
constraints/have suggestions?

To clarify, what I want is the ability to program in different error
messages to display depending on which constraint is violated.

Example: Respondent lists their age and their relationship to the head
of household. The answers are then tested against a set of
constraints. If the answers violate a constraint a tailored message
pops up explaining this violation.

··· On Nov 17, 10:54 am, Ulli wrote: > Essentially what I want to do is test an age variable against the > variable defining the interviewee's relationship to the household > head. If the interviewee is too young to have this type of > relationship to the household head, I want a message to pop up stating > so. I believe this would require me to program in multiple constraints > for the same variable. I've tried listing the constraints on separate > lines, and although ODK collect will allow me to view the survey the > constraints don't work as programmed. I've tried combining them in a > single line of code and I get an error in validate that I have already > defined the constraint. Has anyone programmed in multiple/complex > constraints/have suggestions?

hi
how to use of multiple constraint in bind ?

we want this capability but it's not currently possible. only one constraint
(and option custom constraint message) per question.

··· On Wed, Nov 17, 2010 at 12:06 PM, Ulli wrote:

To clarify, what I want is the ability to program in different error
messages to display depending on which constraint is violated.

Example: Respondent lists their age and their relationship to the head
of household. The answers are then tested against a set of
constraints. If the answers violate a constraint a tailored message
pops up explaining this violation.

On Nov 17, 10:54 am, Ulli unisc...@gmail.com wrote:

Essentially what I want to do is test an age variable against the
variable defining the interviewee's relationship to the household
head. If the interviewee is too young to have this type of
relationship to the household head, I want a message to pop up stating
so. I believe this would require me to program in multiple constraints
for the same variable. I've tried listing the constraints on separate
lines, and although ODK collect will allow me to view the survey the
constraints don't work as programmed. I've tried combining them in a
single line of code and I get an error in validate that I have already
defined the constraint. Has anyone programmed in multiple/complex
constraints/have suggestions?

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

Use logical operators (and, or). Below is an example.

Yaw

··· -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Thu, Aug 20, 2015 at 1:21 AM, bikram.k@ptas.com.np wrote:

hi
how to use of multiple constraint in bind ?

--

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.

option -> optional

··· On Wed, Nov 17, 2010 at 12:49 PM, Drew Roos wrote:

we want this capability but it's not currently possible. only one
constraint (and option custom constraint message) per question.

On Wed, Nov 17, 2010 at 12:06 PM, Ulli unischan@gmail.com wrote:

To clarify, what I want is the ability to program in different error
messages to display depending on which constraint is violated.

Example: Respondent lists their age and their relationship to the head
of household. The answers are then tested against a set of
constraints. If the answers violate a constraint a tailored message
pops up explaining this violation.

On Nov 17, 10:54 am, Ulli unisc...@gmail.com wrote:

Essentially what I want to do is test an age variable against the
variable defining the interviewee's relationship to the household
head. If the interviewee is too young to have this type of
relationship to the household head, I want a message to pop up stating
so. I believe this would require me to program in multiple constraints
for the same variable. I've tried listing the constraints on separate
lines, and although ODK collect will allow me to view the survey the
constraints don't work as programmed. I've tried combining them in a
single line of code and I get an error in validate that I have already
defined the constraint. Has anyone programmed in multiple/complex
constraints/have suggestions?

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

thanks for your suggestion.

··· On Fri, Aug 21, 2015 at 12:17 AM, Yaw Anokwa wrote:

Use logical operators (and, or). Below is an example.

Yaw

Need ODK services? http://nafundi.com provides form design, server
setup, professional support, and software development for ODK.

On Thu, Aug 20, 2015 at 1:21 AM, bikram.k@ptas.com.np wrote:

hi
how to use of multiple constraint in bind ?

--

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.

--

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/fLB-btzKEuI/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.

--

Regards,
Bikram

Is this a limitation within ODK or JavaRosa? Is this a feature that
could eventually be added?

··· On Nov 17, 12:50 pm, Drew Roos wrote: > option -> optional > > > > > > > > On Wed, Nov 17, 2010 at 12:49 PM, Drew Roos wrote: > > we want this capability but it's not currently possible. only one > > constraint (and option custom constraint message) per question. > > > On Wed, Nov 17, 2010 at 12:06 PM, Ulli wrote: > > >> To clarify, what I want is the ability to program in different error > >> messages to display depending on which constraint is violated. > > >> Example: Respondent lists their age and their relationship to the head > >> of household. The answers are then tested against a set of > >> constraints. If the answers violate a constraint a tailored message > >> pops up explaining this violation. > > >> On Nov 17, 10:54 am, Ulli wrote: > >> > Essentially what I want to do is test an age variable against the > >> > variable defining the interviewee's relationship to the household > >> > head. If the interviewee is too young to have this type of > >> > relationship to the household head, I want a message to pop up stating > >> > so. I believe this would require me to program in multiple constraints > >> > for the same variable. I've tried listing the constraints on separate > >> > lines, and although ODK collect will allow me to view the survey the > >> > constraints don't work as programmed. I've tried combining them in a > >> > single line of code and I get an error in validate that I have already > >> > defined the constraint. Has anyone programmed in multiple/complex > >> > constraints/have suggestions? > > >> -- > >> Post: opendatakit@googlegroups.com > >> Unsubscribe: opendatakit+unsubscribe@googlegroups.com > >> Options:http://groups.google.com/group/opendatakit?hl=en

javarosa, and yes

··· On Wed, Nov 17, 2010 at 1:09 PM, Arthur wrote:

Is this a limitation within ODK or JavaRosa? Is this a feature that
could eventually be added?

On Nov 17, 12:50 pm, Drew Roos dr...@dimagi.com wrote:

option -> optional

On Wed, Nov 17, 2010 at 12:49 PM, Drew Roos dr...@dimagi.com wrote:

we want this capability but it's not currently possible. only one
constraint (and option custom constraint message) per question.

On Wed, Nov 17, 2010 at 12:06 PM, Ulli unisc...@gmail.com wrote:

To clarify, what I want is the ability to program in different error
messages to display depending on which constraint is violated.

Example: Respondent lists their age and their relationship to the head
of household. The answers are then tested against a set of
constraints. If the answers violate a constraint a tailored message
pops up explaining this violation.

On Nov 17, 10:54 am, Ulli unisc...@gmail.com wrote:

Essentially what I want to do is test an age variable against the
variable defining the interviewee's relationship to the household
head. If the interviewee is too young to have this type of
relationship to the household head, I want a message to pop up
stating
so. I believe this would require me to program in multiple
constraints
for the same variable. I've tried listing the constraints on
separate
lines, and although ODK collect will allow me to view the survey the
constraints don't work as programmed. I've tried combining them in a
single line of code and I get an error in validate that I have
already
defined the constraint. Has anyone programmed in multiple/complex
constraints/have suggestions?

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.comopendatakit%2Bunsubscribe@googlegroups.com
<opendatakit%2Bunsubscribe@googlegr oups.com>
Options:http://groups.google.com/group/opendatakit?hl=en

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

Hi, sorry to bump up this old conversation but I'm curious if this was ever added as feature of if there's any workaround?

EDIT: To clarify, I'm interested if you can have multiple constraint messages that could be dependent on different constraint violations

Welcome to the ODK forum, @nsivewright ! We're glad you're here. When you get a chance, please introduce yourself here. I'd also encourage you to add a real picture as your avatar because it helps build community!

Can you provide a more detailed use-case example? Or better yet, an excerpt from a form where you would like to implement this?

1 Like

Hopefully it's not too late to revive this discussion...but if it isn't...

My use case for this particular feature is as follows:

  1. I want to confirm that the entered value has not been encountered before (by co-opting #last-saved).
  2. I want to confirm that the entered value is one on a list of allowed values.

While this is possible using logical operators and works well for some constraints that can be easily explained with a single constraint message, it breaks down when the constraints are entirely unrelated and we want to provide a useful message for the form enumerators. Was this value encountered before? Or is it not allowed at all?

What I've done to satisfy a need like this is to put a note in a field list with the field with the complex constraint requirement. That note can contain a long message with instructions about how to recover from the issue, maybe even linking out to documentation. It can be colored, etc.

For example: https://docs.google.com/spreadsheets/d/1cpDenVu0fEeM1ZpGUDaLJq-4o3EfHRoPM9anziS4j3I/edit#gid=0

1 Like

This is a wonderfully straight forward solution! Thanks so much for the quick response. We have a need for more help text in this part of the page anyways, so this will fit quite nicely.

1 Like