Bienvenue, Invité
Nom d'utilisateur : Mot de passe : Se souvenir de moi

SUJET : Lime: Piping from Array to List question

Lime: Piping from Array to List question il y a 3 ans 2 mois #55799

  • sivajik
  • Portrait de sivajik
  • Hors ligne
  • Fresh Lemon
  • Messages : 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
L'administrateur a désactivé l'accès en écriture pour le public.

Re: Lime: Piping from Array to List question il y a 3 ans 2 mois #55824

  • tpartner
  • Portrait de tpartner
  • Hors ligne
  • LimeSurvey Team
  • Messages : 3844
  • Remerciements reçus 690
  • Karma: 330
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.
L'administrateur a désactivé l'accès en écriture pour le public.

Re: Lime: Piping from Array to List question il y a 3 ans 2 mois #55833

  • sivajik
  • Portrait de sivajik
  • Hors ligne
  • Fresh Lemon
  • Messages : 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
L'administrateur a désactivé l'accès en écriture pour le public.

Re: Lime: Piping from Array to List question il y a 3 ans 2 mois #55839

  • Mazi
  • Portrait de Mazi
  • Hors ligne
  • LimeSurvey Team
  • Messages : 5279
  • Remerciements reçus 289
  • Karma: 246
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'"
L'administrateur a désactivé l'accès en écriture pour le public.

Re: Lime: Piping from Array to List question il y a 3 ans 2 mois #55940

  • tpartner
  • Portrait de tpartner
  • Hors ligne
  • LimeSurvey Team
  • Messages : 3844
  • Remerciements reçus 690
  • Karma: 330
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.
Dernière édition: il y a 3 ans 2 mois par tpartner.
L'administrateur a désactivé l'accès en écriture pour le public.

Re: Lime: Piping from Array to List question il y a 3 ans 2 mois #56614

  • sivajik
  • Portrait de sivajik
  • Hors ligne
  • Fresh Lemon
  • Messages : 8
  • Karma: 0
Thanks a lot Tony. I really appreciate your help. You are the man!
L'administrateur a désactivé l'accès en écriture pour le public.

Re: Lime: Piping from Array to List question il y a 3 ans 2 mois #56618

  • Mazi
  • Portrait de Mazi
  • Hors ligne
  • LimeSurvey Team
  • Messages : 5279
  • Remerciements reçus 289
  • Karma: 246
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'"
L'administrateur a désactivé l'accès en écriture pour le public.
Modérateurs: ITEd
Temps de génération de la page : 0.140 secondes
Donation Image