- Posts: 41
- Thank you received: 0

# Question validation equation

1 year 1 week ago - 1 year 1 week 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: 1 year 1 week ago by jackuars.

Please Log in or Create an account to join the conversation.

1 year 1 week ago #157460
by Joffm

Joffm replied the topic: Question validation equation

Hi,

comparison is "Q1==1", NOT "Q1=1".

I will check more intensively later.

Joffm

comparison is "Q1==1", NOT "Q1=1".

I will check more intensively later.

Joffm

*Volunteers are not paid.*

Not because they are worthless, but because they are priceless

Not because they are worthless, but because they are priceless

Please Log in or Create an account to join the conversation.

1 year 1 week ago #157461
by jackuars

jackuars replied the topic: Question validation equation

I tried that too, but it gives me same popup error

Please Log in or Create an account to join the conversation.

1 year 1 week 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

*Volunteers are not paid.*

Not because they are worthless, but because they are priceless

Not because they are worthless, but because they are priceless

Please Log in or Create an account to join the conversation.

1 year 1 week 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

*Volunteers are not paid.*

Not because they are worthless, but because they are priceless

Not because they are worthless, but because they are priceless

The following user(s) said Thank You: jackuars

Please Log in or Create an account to join the conversation.

1 year 3 days ago - 1 year 3 days 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: 1 year 3 days ago by jackuars.

Please Log in or Create an account to join the conversation.

1 year 3 days 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 or Create an account to join the conversation.