Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Set range condition for Other option & Multiple numerical input

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 7 months ago #220109 by Joffm
Let the validation start when both fields are "not empty"

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • xueting
  • xueting's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 7 months ago - 2 years 7 months ago #220112 by xueting
Sorry I don't understand, may I ask for your help with the attached lss. file please?
 

File Attachment:

File Name: limesurvey...4848.lss
File Size:21 KB


Many thanks,
Xueting
Last edit: 2 years 7 months ago by xueting.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 7 months ago #220114 by Joffm
You have to allow the empty fields.
If you say !is_empty() AND ... you have an error right at the start.
Of course these fields may be empty.
That they don't stay empty is because the question is mandatory.

So (is_empty(1) OR (is_empty(2)) and ...

 



Adapt the error messages.

Joffm

And you should remove this "0" from the default answers

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • xueting
  • xueting's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 6 months ago #220233 by xueting
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.

   
 

File Attachment:

File Name: limesurvey... (1).lss
File Size:21 KB

Many thanks,Xueting 
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 6 months ago #220242 by Joffm
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






Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 6 months ago - 2 years 6 months ago #220250 by Joffm
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)

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 2 years 6 months ago by Joffm.
The topic has been locked.
  • xueting
  • xueting's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 6 months ago #220369 by xueting
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
The topic has been locked.
  • xueting
  • xueting's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 6 months ago - 2 years 6 months ago #220489 by xueting
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. 

File Attachment:

File Name: limesurvey... (3).lss
File Size:26 KB

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
Last edit: 2 years 6 months ago by xueting.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 6 months ago - 2 years 6 months ago #220504 by Joffm
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

 

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 2 years 6 months ago by Joffm.
The topic has been locked.
  • xueting
  • xueting's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 6 months ago #220507 by xueting
It works! Thank you very much for your help.

Best wishes,
Xueting
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose