Welcome, Guest
Username: Password: Remember me

TOPIC: Lime: Piping from Array to List question

Lime: Piping from Array to List question 3 years 8 months ago #55799

  • sivajik
  • sivajik's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 8
  • Karma: 0
In LIME, I have one "Array" question that will have items people will be rating on a 10-point scale. Is there a way to have only the items that people rated a score of 5 or higher to show up in the next question (a "List (radio)" question). And, if no items are rated 5 or higher, the question would need to be skipped. Is this possible?

Below is a survey link as an example. If someone rates chooses a score of 5, 6, 7, 8, 9, or 10 for "Red" and "Blue", but chooses a score of 1, 2, 3, or 4 for "Green" and "Orange", then in the second question I'd only like "Red" and "Blue" to appear. And, if someone gives all four colors a score of 1,2,3,or 4, then they should skip the question.
209.92.23.95/index.php?sid=27812&lang=en

Please help me out. Thanks in advance

Sivaji
The administrator has disabled public write access.

Re: Lime: Piping from Array to List question 3 years 8 months ago #55824

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4256
  • Thank you received: 801
  • Karma: 367
I think you will need to place a hidden multiple choice question on page 1 and use JavaScript to populate it depending on the Q1 responses. You can then use array filter and conditions to control the behaviour of Q2 on page 2.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Lime: Piping from Array to List question 3 years 8 months ago #55833

  • sivajik
  • sivajik's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 8
  • Karma: 0
Thanks Tony. Can you please give me some code snippet if you don't mind. I noticed array_filter works only for list(radio) question type. If you see my Q1 I am using Array (5 point choice) question type. Can you please shed some more light on this? Thanks in advance
The administrator has disabled public write access.

Re: Lime: Piping from Array to List question 3 years 8 months ago #55839

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5325
  • Thank you received: 296
  • Karma: 249
Without some customized Javascript - as suggested by Tony - there is no way to solve this.
Tony offer advanced (paid) support so if you are no JS expert he might help you out.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: Lime: Piping from Array to List question 3 years 8 months ago #55940

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4256
  • Thank you received: 801
  • Karma: 367
Okay, here's what I would do:

1) In group 1, after your array question, create a multi-options question with the same answers and answer codes as the radio question in group 2 (we'll hide it later with JavScript).

2) Apply an array-filter to the radio question in group 2 based on the multi-options in group 1

3) Make the radio question in group 2 conditional on any of the multi-options answers in group 1 being checked

4) BEFORE PROCEDING - test the array filter and the condition

5) Set up your survey to use JavaScript and place the following script in the source of the multi-options. Replace "AA" (row 6) with the ID of the array question and "HH" (row 7) with the ID of the multi-options question.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		// The question IDs
		var qArray = AA;
		var qHidden = HH;
 
		// Hide the hidden question
		$('#question'+qHidden+'').hide();
 
		// Assign a class to all "high score" array radio buttons
		$('#question'+qArray+' table.question tbody tr').each(function(i) {
			$('input.radio', this).each(function(i) {
				if (i < 6) {
					$(this).addClass('highScore');
				}
			});
		});
 
		// Interrupt next/submit function
		$('form#limesurvey').submit(function(){
 
			// Reset the hidden question
			$('#question'+qHidden+' input.checkbox').attr('checked', false);
 
			// Check the appropriate boxes of the hidden question
			$('#question'+qArray+' table.question tbody tr').each(function(i) {
				if($('.highScore:checked', this).length > 0) {
					$('#question'+qHidden+' li:eq('+i+') input.checkbox').attr('checked', true);
				}
			});
 
			// Carry on with submit
			return true;
		});
	});
 
</script>

The script will:
- hide the multi-options question
- interrupt the Next/Submit function and if any row in the array has one of the first 6 radios selected the corresponding checkbox in the multi-options question is checked.

The array filter should then display only the corresponding option in the radio question in group 2.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 3 years 8 months ago by tpartner.
The administrator has disabled public write access.

Re: Lime: Piping from Array to List question 3 years 8 months ago #56614

  • sivajik
  • sivajik's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 8
  • Karma: 0
Thanks a lot Tony. I really appreciate your help. You are the man!
The administrator has disabled public write access.

Re: Lime: Piping from Array to List question 3 years 8 months ago #56618

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5325
  • Thank you received: 296
  • Karma: 249
You're welcome. Have a look at donate.limesurvey.org ...

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.134 seconds
Donation Image