Validation rule for selecting person based on age difference

I am trying to create the following question:

I would like a validation warning if the age of the person selected is outside of the expected. relat 16 is the option “OTHER” in the relationship to head question.

As it stands, I get a warning no matter who I choose. What am I doing wrong?

gwelch, you are getting a warning no matter whom you choose because your validation condition is not dependent on the P33c that you are validating.

The fact of the answer is sufficient to run validation, but the actual value of the answer is irrelevant based on your condition.

What you wanted to achieve is not clear [to me].

I want all the males in the household to be listed, which is what is happening. But I want to go further and add validation if the interviewer selects someone who is unlikely to be the husband/partner.

The way I understand it, it is something like:

Math.Abs(age-hhroster[self[0]].age)<=12

What I don’t understand is how .Count() is at all relevant? It is about two persons, current and selected.

1 Like

My bad coding. Sorry. I change your suggestion to

Math.Abs((long)age-(long)hhroster[self[0]].age)<=12

and it seems to be working now. Thanks.