# Constraint message from previous integer variable

Hi,

I have trouble with my survey. For example

Q1. Age in years:_______(0 - 99) (Integer variable)
Q2. What is your job ? (Select_one variable)

1. Officer
2. Doctor
3. Housewife
4. Children under 6 years old
5. Other

Now I need to show the constraint message when Q1 = 50, and Q2 were selected = 4 (Children under 6), the contraint message is "Chẹck the age".

Thank you very much for your help

Trinh

Why not you include under the survey sheet, .==50 under constraint column in Q2

Try something like this for the constraint on Q2:

(.!=4) or (\${Q1}!=50)

which basically says, if you select 4 for Q2, then Q1 cant be 50 (if you dont select 4 then the above expression is already true, so the value of Q1 doesn't matter).

Although I do have to ask why 50 is the magic number? (it would seem that if you select 4, then your specified age should necessarily be <6, as opposed to anything except 50...)

• Gareth

Thank Gareth, I mean if in Q1 I select any number > 6 (7 or 9 or 20 or 30 or 50, 55 ....) so in Q2 I can not select 4 (Children under 6)

That makes more sense. Try this instead then:

(.!=4) or (\${Q1}>6)

(I'll leave it up to you to decide if "children under 6" means <6 or <=6...)

1 Like

Many thank Gareth. This is so helpful

YW. If you get it working please remember close out this question thread as 'solved'.