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

  • xueting
  • xueting's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 8 months ago - 2 years 8 months ago #219185 by xueting
Hi all,
There are 2 questions about setting ranges for answers, I would appreciate if there will be any help. The lss. file is attached.  

File Attachment:

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

Firstly, I was wondering is it possible to set range for the other option of List (radio)? In the following question showed in the 1st picture, the other option is for one-day cost of car-parking, and I'd like to set the range such as 20.

 

The 2nd is in regard to the Multiple numerical input showed in the 2nd picture. I read a post about how to set different ranges for answers,
forums.limesurvey.org/forum/can-i-do-thi...nge-condition#179363

The thing is it didn't work in my case. The ranges I expect for the 1st answer (hour) is 4, for the 2nd (minute) is 59.  Thus I entered the following into the question validatoin equation: (!is_empty(TripTimeWork_SQ001) AND !is_empty(TripTimeWork_SQ002) AND TripTimeWork_SQ001<4 AND TripTimeWork_SQ002<59)
Seems only Maximum value of input (59) works here. Now the max. limitation for both of them are 59.

 

Kind regards,
Xueting
Last edit: 2 years 8 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 #219208 by Joffm
Hm, nearly correct.

Here your example back with some improvements.
 

File Attachment:

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


You may fine tune the error messages.

   


Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • xueting
  • xueting's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 7 months ago #219222 by xueting
Thank you so much Joffm for your prompt reply, but there seems another problem for the quetion of List(radio), that is the survey can go on ONLY when the Other option is chosen. When chosing others, there will be the following note:

 

I was wondering how to cope with it?
Many thanks,
Xueting
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 7 months ago #219231 by Joffm
You just have to add the case that a normal item was selected, like this
(CarParkWork=='-oth-' AND CarParkWork_other < 20) or (CarParkWork!='-oth-')

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 #219233 by xueting
Understand, thanks a lot!

Xueting
The topic has been locked.
  • xueting
  • xueting's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 7 months ago #219256 by xueting
Hi Joffm, I was also wondering whether it's possible to establish logical relationships between ranges and answers? E.g. the range of trip time is dependent on the trip distance they would indicate.

Best regards,
Xueting
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 7 months ago #219258 by Joffm
Of course it is possible.
Without knowing more, I should say
Use an equation with a nested if statement to set the time range depending on distance.
Use the result of the equation to set the logic of the time question.

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 #219266 by xueting
Thank you Joffm for your guidance!
It seems work well after I revised the equations a bit, I would appreciate if you could let me know once there is any problem in my equations.
Say the limitation is trip time < 0.05* trip distance:
   
 

Many thanks
Xueting
 
Last edit: 2 years 7 months ago by xueting.
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 #219474 by xueting
Hi Joffm,
There is another question, whether it's possible to set ranges for boxes in table of Array(text)?
The lss.file is attached. As the following picture shows, column 1 and 4 are all the text field, I was wondering could they be set as numerical input and column 1 <100 while column 4<200?
   

File Attachment:

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


Best regards,
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 #219495 by Joffm
Hi,
you have to validate.
Here for the first row:
(is_empty(Q1_Y001_X001) or (is_numeric(Q1_Y001_X001) and Q1_Y001_X001 ge 0 and Q1_Y001_X001 lt 100)) and (is_empty(Q1_Y001_X004) or (is_numeric(Q1_Y001_X004) and Q1_Y001_X004 ge 0 and Q1_Y001_X004 lt 200))

and a hint like
{if(!is_empty(Q1_Y001_X001) and (!is_numeric(Q1_Y001_X001) or Q1_Y001_X001 ge 100),"Only numbers between 0 and 99 in column 1",if(!is_empty(Q1_Y001_X004) and (!is_numeric(Q1_Y001_X004) or Q1_Y001_X004 ge 200),"Only numbers between 0 and 199 in column 4",""))

 
 


You have to extend the validation for the other rows.

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 #219684 by xueting
Thank you Joffm! It works well:)
Best regards,
Xueting
The topic has been locked.
  • xueting
  • xueting's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 7 months ago #220107 by xueting
Hi Joffm,
I have another question. That is when there is more than one range condition for a question,  then the red(!) without text would always there before all answers for blanks are entered, and the red(!) will turn to green (!) when the eligible answers are put in the blanks. It seems this mechanism of red(!) without text is a bit misleading. I was wondering can it disappear?

Many thanks,
Xueting
   
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose