- Posts: 23
- Thank you received: 0

# Question validation equation

4 months 6 days ago - 4 months 6 days ago #157425
by jackuars

jackuars created the topic: Question validation equation

Hi please take a look at the question group I created.

It has 4 questions

1. How much do you pay for your internet now? [ListRadio with 4 options "100-150, 151-200, 201-250, 251-300"]

2. What is the exact amount you pay for your internet? [Numeric, The number you input here should be based on Question 1 within the same range]

3. Has the amount increased/decreased compared to last time [ListRadio with 2 options "Increase" & "Decrease"]

4. How much did you pay for your internet earlier [Numeric, the answer should satisfy the condition based on Q2 and Q3]

But somehow it doesn't work when you choose option 2, 3 or 4 in Question 1 with a message "not answered in a valid manner". Can you please tell me how to correct this? I would prefer if no more question is to be added.

It has 4 questions

1. How much do you pay for your internet now? [ListRadio with 4 options "100-150, 151-200, 201-250, 251-300"]

2. What is the exact amount you pay for your internet? [Numeric, The number you input here should be based on Question 1 within the same range]

3. Has the amount increased/decreased compared to last time [ListRadio with 2 options "Increase" & "Decrease"]

4. How much did you pay for your internet earlier [Numeric, the answer should satisfy the condition based on Q2 and Q3]

But somehow it doesn't work when you choose option 2, 3 or 4 in Question 1 with a message "not answered in a valid manner". Can you please tell me how to correct this? I would prefer if no more question is to be added.

Last Edit: 4 months 6 days ago by jackuars.

Please Log in to join the conversation.

4 months 5 days ago #157465
by Joffm

Joffm replied the topic: Question validation equation

Hi, jackuars,

well, that's because there was something wrong in your equation.

I tried a different approach:

You have the four categories in Q2: 1,2,3,4 and the ranges : "101-150", "151-200", ...

So you can calculate the ranges by (Q2+1)*50+1 - (Q2+2)*50.

Therefore I changed your validation equation to :

((Q2.NAOK+1)*50<Q2a.NAOK) AND (Q2a.NAOK<=(Q2.NAOK+2)*50)

Your second equation in Q2c is fine.

Best regards

Joffm

well, that's because there was something wrong in your equation.

I tried a different approach:

You have the four categories in Q2: 1,2,3,4 and the ranges : "101-150", "151-200", ...

So you can calculate the ranges by (Q2+1)*50+1 - (Q2+2)*50.

Therefore I changed your validation equation to :

((Q2.NAOK+1)*50<Q2a.NAOK) AND (Q2a.NAOK<=(Q2.NAOK+2)*50)

Your second equation in Q2c is fine.

Best regards

Joffm

Please Log in to join the conversation.

4 months 4 days ago #157477
by Joffm

Joffm replied the topic: Question validation equation

Hi,

just to add something.

When we ask for age or other real numbers and need the classification too, we ask only the number and calculate the category by a hidden equation.

Is there a special reason that you do it the other way?

Best regards

Joffm

just to add something.

When we ask for age or other real numbers and need the classification too, we ask only the number and calculate the category by a hidden equation.

Is there a special reason that you do it the other way?

Best regards

Joffm

The following user(s) said Thank You: jackuars

Please Log in to join the conversation.

4 months 8 hours ago - 4 months 8 hours ago #157562
by jackuars

jackuars replied the topic: Question validation equation

Thank you for your alternate expression, I will try it out.

The survey is conducted in this way because we needed to know that the respondents are not giving rigged answers, so that if it does validate as per their previous question, then most certainly we can know that they're not doing it in a hurry.

But most of all, what I wanted to know is that what's wrong with my question validation equation for Q2a.

If you just consider the first 2 questions (Q2 & Q2a), the first question asks 4 options, and the second question simply has a validation for a numerical input to see if it falls inside the range of the previous question.

The survey is conducted in this way because we needed to know that the respondents are not giving rigged answers, so that if it does validate as per their previous question, then most certainly we can know that they're not doing it in a hurry.

But most of all, what I wanted to know is that what's wrong with my question validation equation for Q2a.

If you just consider the first 2 questions (Q2 & Q2a), the first question asks 4 options, and the second question simply has a validation for a numerical input to see if it falls inside the range of the previous question.

Last Edit: 4 months 8 hours ago by jackuars.

Please Log in to join the conversation.

4 months 7 hours ago #157563
by jackuars

jackuars replied the topic: Question validation equation

Hi, I found what was wrong with the equation.

Else-if statements requires a else statement at the end, and should never end with elseif.

Previously the equation read as:

if(Q2=="1",Q2a>=101 and Q2a<=150,

if(Q2=="2",Q2a>=151 and Q2a<=200,

if(Q2=="3",Q2a>=201 and Q2a<=250,

if(Q2=="4",Q2a>=251 and Q2a<=300))))

I changed it to:

if(Q2=="1",Q2a>=101 and Q2a<=150,

if(Q2=="2",Q2a>=151 and Q2a<=200,

if(Q2=="3",Q2a>=201 and Q2a<=250,

Q2a>=251 and Q2a<=300)))

The only change is coming in the last part of the equation.

Else-if statements requires a else statement at the end, and should never end with elseif.

Previously the equation read as:

if(Q2=="1",Q2a>=101 and Q2a<=150,

if(Q2=="2",Q2a>=151 and Q2a<=200,

if(Q2=="3",Q2a>=201 and Q2a<=250,

if(Q2=="4",Q2a>=251 and Q2a<=300))))

I changed it to:

if(Q2=="1",Q2a>=101 and Q2a<=150,

if(Q2=="2",Q2a>=151 and Q2a<=200,

if(Q2=="3",Q2a>=201 and Q2a<=250,

Q2a>=251 and Q2a<=300)))

The only change is coming in the last part of the equation.

Please Log in to join the conversation.