Numeric answer to a question must be smaller than the answer to the previous question - how to do it?

Hello,

I would like to create a validation rule for a question so that the numeric
answer *must *be smaller than the numeric answer to the previous question.
Is there a way to do this in CommCare?

For instance, in the first question, I'm asking the respondent "what is
your total land size in hectares?" and in the second question, I'm asking
them "how many hectares of maize did you plant in total?" In this case, the
answer to the second question cannot be greater than the answer to the
first question and I want to make sure our enumerators will not enter the
wrong response.

Any help is greatly appreciated, thank you!

Satoshi

Hi Satoshi,

You're correct that you could use a validation rule to accomplish this.
From the sound of it, you'd need two integer questions. In your example:

  1. What is your total land size in hectares?
  2. How many hectares of maize did you plant in total?

On question two, you would add a Validation Condition that would read
something like, ". <= question_two" - or in the Expression editor, you
could drag question two into the first field, select "is less than or equal
to" and then drag question one into the second field.

Regards,
Ben

··· On Wednesday, September 7, 2016 at 10:39:44 AM UTC-4, Satoshi Endo wrote: > > Hello, > > I would like to create a validation rule for a question so that the > numeric answer *must *be smaller than the numeric answer to the previous > question. Is there a way to do this in CommCare? > > For instance, in the first question, I'm asking the respondent "what is > your total land size in hectares?" and in the second question, I'm asking > them "how many hectares of maize did you plant in total?" In this case, the > answer to the second question cannot be greater than the answer to the > first question and I want to make sure our enumerators will not enter the > wrong response. > > Any help is greatly appreciated, thank you! > > Satoshi >

exactly what I'm looking for. Thanks so much!!

··· On Wednesday, September 7, 2016 at 5:16:47 PM UTC+2, btalbot wrote: > > Hi Satoshi, > > You're correct that you could use a validation rule to accomplish this. > From the sound of it, you'd need two integer questions. In your example: > > 1. What is your total land size in hectares? > 2. How many hectares of maize did you plant in total? > > On question two, you would add a Validation Condition that would read > something like, ". <= question_two" - or in the Expression editor, you > could drag question two into the first field, select "is less than or equal > to" and then drag question one into the second field. > > Regards, > Ben > > On Wednesday, September 7, 2016 at 10:39:44 AM UTC-4, Satoshi Endo wrote: >> >> Hello, >> >> I would like to create a validation rule for a question so that the >> numeric answer *must *be smaller than the numeric answer to the previous >> question. Is there a way to do this in CommCare? >> >> For instance, in the first question, I'm asking the respondent "what is >> your total land size in hectares?" and in the second question, I'm asking >> them "how many hectares of maize did you plant in total?" In this case, the >> answer to the second question cannot be greater than the answer to the >> first question and I want to make sure our enumerators will not enter the >> wrong response. >> >> Any help is greatly appreciated, thank you! >> >> Satoshi >> >