- Posts: 39
- Thank you received: 0

- Forum
- English support forums
- Can I do this with LimeSurvey?
- Set range condition for Other option & Multiple numerical input

# Set range condition for Other option & Multiple numerical input

2 months 1 week ago #220233
by xueting

Replied by

*xueting*on topic*Set range condition for Other option & Multiple numerical input*
Thank you for your help! The thing is I still couldn't make it. And I would appreciate if you would take a look at my attached lss. file.

After adding the following at the beginning of the question validation equation: (is_empty(1) OR (is_empty(2)); and removing the default value, there is no red(!) before entering the answer, but there is always a red(!) when the valid numbers are entered, at the same time, it cannot proceed because it shows "invalid answer", actually they should be valid.

Many thanks,Xueting

After adding the following at the beginning of the question validation equation: (is_empty(1) OR (is_empty(2)); and removing the default value, there is no red(!) before entering the answer, but there is always a red(!) when the valid numbers are entered, at the same time, it cannot proceed because it shows "invalid answer", actually they should be valid.

Many thanks,Xueting

##### Attachments:

Please Log in to join the conversation.

2 months 1 week ago #220242
by Joffm

Replied by

*Joffm*on topic*Set range condition for Other option & Multiple numerical input*
Quite easy, your equation is wrong.

Did you have a look at it?

You say

(empty(1) OR empty(2)) and (not_empty(1) and not_empty(2))

You really want to have it empty and at the same time not_empty.

The "not_empty" is obsolete.

Either (1) is empty or (1) is <4

(2) analogue.

Joffm

Did you have a look at it?

You say

(empty(1) OR empty(2)) and (not_empty(1) and not_empty(2))

You really want to have it empty and at the same time not_empty.

The "not_empty" is obsolete.

Either (1) is empty or (1) is <4

(2) analogue.

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

##### Attachments:

Please Log in to join the conversation.

2 months 1 week ago - 2 months 1 week ago #220250
by Joffm

Replied by

*Joffm*on topic*Set range condition for Other option & Multiple numerical input*
Well,

1. Your validation tip i correct

This validation tip is shown when the equation is FALSE.

But in your validation equation you enter the condition when the result is TRUE

You only have to negate the condition of your validation tip.

So do some mathematical transformations (as we learned at school)

You know these rules:

NOT (X AND Y) = NOT X OR NOT Y

NOT (X OR Y) = NOT X AND NOT Y

Here the structure of your negated validation tip

NOT ((X AND Y) OR (C AND D)) =

(NOT (X AND Y)) AND NOT(C AND D)) =

(NOT X OR NOT Y) AND (NOT C OR NOT D)

Just insert your equations:

A: !is_empty(TripTime_SQ001)

B: TripTime_SQ001>3

A: !is_empty(TripTime_SQ002)

B: TripTime_SQ002>59

and you get

! ((!is_empty(self.sq_SQ001) AND self.sq_SQ001>3) OR (!is_empty(self.sq_SQ002) AND self(sq_SQ002>59)) =

(! (!is_empty(self.sq_SQ001) AND self.sq_SQ001>3) AND ! (!is_empty(self.sq_SQ002) AND self(sq_SQ002>59) =

(is_empty(self.sq_SQ001) OR self.sq_SQ001<4) AND (is_empty(self.sq_SQ002) OR self(sq_SQ002<60)

This is simple boolean algebra.

2. Consider the positive outcome

First field is_empty OR the value is less than 4 (obviously in this case it is not empty

AND

Second field is_empty OR the value is less than 60 (obviously in this case it is not empty

So you get the same result:

(is_empty(self.sq_SQ001) OR self.sq_SQ001<4) AND (is_empty(self.sq_SQ002) OR self(sq_SQ002<60)

1. Your validation tip i correct

This validation tip is shown when the equation is FALSE.

But in your validation equation you enter the condition when the result is TRUE

You only have to negate the condition of your validation tip.

So do some mathematical transformations (as we learned at school)

You know these rules:

NOT (X AND Y) = NOT X OR NOT Y

NOT (X OR Y) = NOT X AND NOT Y

Here the structure of your negated validation tip

NOT ((X AND Y) OR (C AND D)) =

(NOT (X AND Y)) AND NOT(C AND D)) =

(NOT X OR NOT Y) AND (NOT C OR NOT D)

Just insert your equations:

A: !is_empty(TripTime_SQ001)

B: TripTime_SQ001>3

A: !is_empty(TripTime_SQ002)

B: TripTime_SQ002>59

and you get

! ((!is_empty(self.sq_SQ001) AND self.sq_SQ001>3) OR (!is_empty(self.sq_SQ002) AND self(sq_SQ002>59)) =

(! (!is_empty(self.sq_SQ001) AND self.sq_SQ001>3) AND ! (!is_empty(self.sq_SQ002) AND self(sq_SQ002>59) =

(is_empty(self.sq_SQ001) OR self.sq_SQ001<4) AND (is_empty(self.sq_SQ002) OR self(sq_SQ002<60)

This is simple boolean algebra.

2. Consider the positive outcome

First field is_empty OR the value is less than 4 (obviously in this case it is not empty

AND

Second field is_empty OR the value is less than 60 (obviously in this case it is not empty

So you get the same result:

(is_empty(self.sq_SQ001) OR self.sq_SQ001<4) AND (is_empty(self.sq_SQ002) OR self(sq_SQ002<60)

*Volunteers are not paid.*

Not because they are worthless, but because they are priceless

Not because they are worthless, but because they are priceless

Last edit: 2 months 1 week ago by Joffm.

Please Log in to join the conversation.

2 months 6 days ago #220369
by xueting

Replied by

*xueting*on topic*Set range condition for Other option & Multiple numerical input*
Thank you Joffm for the detailed interpretation, it's crystal clear! Now I understand.

Thanks again for your patience！

Regards and have a nice day,

Xueting

Thanks again for your patience！

Regards and have a nice day,

Xueting

Please Log in to join the conversation.

2 months 2 days ago - 2 months 2 days ago #220489
by xueting

Replied by

*xueting*on topic*Set range condition for Other option & Multiple numerical input*
Hi Joffm,

Excuse me, there is another strange problem I just found...

That is when a question is related to the former question, the red(!) began to appear with all other tips.

In the following picture, the second question would only appear when the option "car" in the 1st question is chosen, and the third question would always appear. Everything else is the same among those 2 questions.

Then there is the red(!) in the 2nd question before any answer is chosen while not in 3rd question.

I was wondering is it possible to remove the red(!) in the 2nd question?

The lss. file is attached.

In addition, the above 2nd and 3rd questions are List(radio), but I tested with the 4th question which is Multiple numerical input, then this problem disappear.

Many thanks,

Xueting

Excuse me, there is another strange problem I just found...

That is when a question is related to the former question, the red(!) began to appear with all other tips.

In the following picture, the second question would only appear when the option "car" in the 1st question is chosen, and the third question would always appear. Everything else is the same among those 2 questions.

Then there is the red(!) in the 2nd question before any answer is chosen while not in 3rd question.

I was wondering is it possible to remove the red(!) in the 2nd question?

The lss. file is attached.

In addition, the above 2nd and 3rd questions are List(radio), but I tested with the 4th question which is Multiple numerical input, then this problem disappear.

Many thanks,

Xueting

##### Attachments:

Last edit: 2 months 2 days ago by xueting.

Please Log in to join the conversation.

2 months 2 days ago - 2 months 2 days ago #220504
by Joffm

Replied by

*Joffm*on topic*Set range condition for Other option & Multiple numerical input*
Oh, suddenly there is a condition on this question.

So you have to use "NAOK".

Though I do not understand the doubling of the CarPark question, here you have the same issue because of the condition.

And this question is mandatory. Therefore you only have to check of the entry in "others" (less than 20)

is_empty(CarPark_other.NAOK) OR CarPark_other.NAOK<20

So you have to use "NAOK".

Though I do not understand the doubling of the CarPark question, here you have the same issue because of the condition.

And this question is mandatory. Therefore you only have to check of the entry in "others" (less than 20)

is_empty(CarPark_other.NAOK) OR CarPark_other.NAOK<20

*Volunteers are not paid.*

Not because they are worthless, but because they are priceless

Not because they are worthless, but because they are priceless

##### Attachments:

Last edit: 2 months 2 days ago by Joffm.

Please Log in to join the conversation.

2 months 2 days ago #220507
by xueting

Replied by

*xueting*on topic*Set range condition for Other option & Multiple numerical input*
It works! Thank you very much for your help.

Best wishes,

Xueting

Best wishes,

Xueting

Please Log in to join the conversation.