Piping from Multiple Choice to Multiple Numerical

More
5 years 9 months ago #66098 by rvenkat
rvenkat created the topic: Piping from Multiple Choice to Multiple Numerical
Is there a way to pipe answers selected from a Multiple Choice question (in page 1) and set them answer categories for a Multiple Numerical question (in page 2)?

I don't see the logic/array filter under advanced settings for Multiple Numerical. I am wondering if there is a workaround for this?

Thanks very much.

Ramesh

Please Log in to join the conversation.

More
5 years 9 months ago #66102 by rvenkat
rvenkat replied the topic: Piping from Multiple Choice to Multiple Numerical
I should clarify my question.

In Q1, suppose I have something like this:
Which brands of car are you familiar with?
The answer choices are: Brand A, Brand B, Brand C, Brand D, Brand E and Brand F.

Assume that the respondent selected Brand A and Brand B.

In Q2, on page 2, I can use {INSERTANS:34664x144x1558SQ001} etc. as subquestions in the Multiple Numerical question.

When I do this, the subsqquestions for Q2 show up as following:

Brand A
Brand B
No answer
No answer
No answer
No answer

I want only Brand A and Brand B to show up subsquestions in Q2. I am sure I am missing something simple here. How do I filter out the unselected answers from Q1? Under advanced settings there is no array filter option. Is a javascript needed to do what I want?

Thanks.

Ramesh

Please Log in to join the conversation.

More
5 years 9 months ago #66107 by tpartner
tpartner replied the topic: Piping from Multiple Choice to Multiple Numerical
You can use JavaScript.

1) Set up your survey to use JavaScript .

2) Add the following script to the source of the multiple-numeric question. Replace "QQ" with the multiple-numeric question ID .

The script looks for all labels with text that exactly matches "No answer" and hides their parent list item (sub-question row).
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function(){
 
		var qID = QQ;
 
		$('#question'+qID+' label').filter(function() {
			return $(this).text() == 'No answer';
		}).parent().hide();
 
	});
 
</script>

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

Please Log in to join the conversation.

More
5 years 9 months ago #66135 by rvenkat
rvenkat replied the topic: Piping from Multiple Choice to Multiple Numerical
Tony,

Thanks so much. It works like a charm.


Ramesh

Please Log in to join the conversation.

More
5 years 9 months ago #66169 by Mazi
Mazi replied the topic: Piping from Multiple Choice to Multiple Numerical
Great solution, Tony!


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 8 months ago #66622 by stigchelg
stigchelg replied the topic: Piping from Multiple Choice to Multiple Numerical
Hey all,

I'm trying to implement something like this too. I have a multi options question which needs to prefill a multi numerical (slider). I'm trying to use INSERTANS but I can't figure out where to put it.

You state in your top post:
"In Q2, on page 2, I can use {INSERTANS:34664x144x1558SQ001} etc. as subquestions in the Multiple Numerical question."

This is not working for me. When I put the INSERTANS in as a subquestion, I get it as the actual question text. It doesn't 'do' anything.

Please Log in to join the conversation.

More
5 years 8 months ago #66636 by tpartner
tpartner replied the topic: Piping from Multiple Choice to Multiple Numerical
That may indicate that the {INSERTANS} value is incorrect.

Did you use the replacement field button in the editor?

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:

Please Log in to join the conversation.

More
5 years 8 months ago - 5 years 8 months ago #66658 by stigchelg
stigchelg replied the topic: Piping from Multiple Choice to Multiple Numerical
Yes I did. I used the field button to create the INSERTANS and then I pasted that INSERTANS into the subquestion box. That resulted in the INSERTANS being displayed as the subquestion instead of it displaying the value it refers to.

I'm clearly missing the point. Where do I put the INSERTANS? In the subquestion box (where you do not get the editor) or in the question text (where one would normally paste scripts and such)?

I'm using {INSERTANS:81898X39X517SQ001} which should run up to SQ012 to insert all 12 options. They way I understand it is that the filter will display only those options selected in the previous question and display the rest as 'no answer'. You already provided a script to hide those.
Last Edit: 5 years 8 months ago by stigchelg.

Please Log in to join the conversation.

More
5 years 8 months ago #66665 by tpartner
tpartner replied the topic: Piping from Multiple Choice to Multiple Numerical

Where do I put the INSERTANS? In the subquestion box (where you do not get the editor) or in the question text (where one would normally paste scripts and such)?

You do have access to an editor when creating/editing subquestions. Click the little pencil and then add your replacement field.


Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The following user(s) said Thank You: stigchelg

Please Log in to join the conversation.

More
5 years 8 months ago #66671 by stigchelg
stigchelg replied the topic: Piping from Multiple Choice to Multiple Numerical
See, I'm stoopid. You rock. Gonna try this.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now