Piping from Multiple Choice to Multiple Numerical

More
5 years 8 months ago #66705 by Mazi
Mazi replied the topic: Piping from Multiple Choice to Multiple Numerical
If you are missing some information in the manual feel free to improve it. Our manual is a wiki, everyone can edit it and you can't do much wrong.
So if you miss anything in the manual and you found out how to do it please add this information. Thanks!


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 1 month ago #79634 by rvenkat
rvenkat replied the topic: Piping from Multiple Choice to Multiple Numerical
I upgraded to 1.92 Build 120418. The following script provided by Tony does not work in this version of Limesurvey. Nothing else has changed. (Please see my initial question in this thread).


From tpartner's message
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>

Please Log in to join the conversation.

More
5 years 1 month ago #79636 by tpartner
tpartner replied the topic: Piping from Multiple Choice to Multiple Numerical
rvenkat, can you attach a sample survey?

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 1 month ago #79651 by rvenkat
rvenkat replied the topic: Piping from Multiple Choice to Multiple Numerical
Here the link to the survey .
This is just a sample survey I created to demonstrate the problem.

Select only one choice in Group 1 (page 1), and you will see two boxes (one without any label). Also, it asks for value in both boxes.

This was working fine in 1.91.

Thanks for looking into this.

Please Log in to join the conversation.

More
5 years 1 month ago #79653 by tpartner
tpartner replied the topic: Piping from Multiple Choice to Multiple Numerical
Can you please attach an exported copy of the survey?

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 1 month ago #79658 by rvenkat
rvenkat replied the topic: Piping from Multiple Choice to Multiple Numerical
Exported survey file is attached.

thanks very much.


File Attachment:

File Name: limesurvey...3932.lss
File Size:26 KB
Attachments:

Please Log in to join the conversation.

More
5 years 1 month ago #79659 by tpartner
tpartner replied the topic: Piping from Multiple Choice to Multiple Numerical

...does not work in this version of Limesurvey...

Replace your script with this:
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function(){
 
		var qID = QQ;
 
		$('#question'+qID+' label').filter(function() {
			return $(this).text() == '';
		}).parent().hide();
 
	});
 
</script>

Also, it asks for value in both boxes.

Make the question non-mandatory.

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 1 month ago #79665 by rvenkat
rvenkat replied the topic: Piping from Multiple Choice to Multiple Numerical
Thank you so much!
It works now.



Ramesh

Please Log in to join the conversation.

More
4 years 8 months ago #86700 by ck2603
ck2603 replied the topic: Piping from Multiple Choice to Multiple Numerical
Hi,
I found out this post when I was desperately looking for a solution for my problem, and tried it but it didn't work. :(

I wanted to pipe multiple choice responses to another question's text. Assume that I have a question like this:
(in page 1) Q1. what population or group do you think are under-served?
the choices are population A, B, C, D

Assume that the answers are population A and C;

then in page 2, I have another question:
Q2. You indicated {answers from Q1} are under-served....

I got the question text like this:
You indicated population A No answer population C No answer are under-served....

this looks weird so I added in "," between the piped answers, and got this:
You indicated population A, No answer, population C, No answer are under-served....

I tried to get rid of "No answer" so added in the script you posted after Q2:
Q2.You indicated {answers from Q1} are under-served....

<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>

BUT IT DIDN'T WORK.

I replaced QQ by the question ID (17751X270X7545, surveyID: 17751; groupID: 270; QuestionID:7545).
I use version 1.91.

Did I miss anything?

Another question--if I successfully hide all "No answer" in the text, the question will end up like this:

You indicated population A,, population C, are under-served....

which still looks weird as a sentence. Is there any way to make the sentence look ok?

Any help would be appreciate!!!

Please Log in to join the conversation.

More
4 years 8 months ago #86713 by tpartner
tpartner replied the topic: Piping from Multiple Choice to Multiple Numerical
ck2603, please attach a small sample survey.

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
4 years 8 months ago - 4 years 8 months ago #86725 by ck2603
ck2603 replied the topic: Piping from Multiple Choice to Multiple Numerical
Attached please found the exported sample survey.
Thanks very much for your help!

In addition, I noticed another problem: I couldn't pipe the response from "other" category into the place where needed. The identifier {INSERTANS:17751X270X7545other} doesn't work. I DID use the replacement property to get this. What is wrong?

File Attachment:

File Name: SampleSurv...ping.lss
File Size:26 KB
Attachments:
Last Edit: 4 years 8 months ago by ck2603. Reason: added in one more question

Please Log in to join the conversation.

More
4 years 8 months ago #86733 by TMSWhite
TMSWhite replied the topic: Piping from Multiple Choice to Multiple Numerical
For your Q2, you can use this:
You indicated that {list(that.Q1.shown, Q1_other)} are underserved for disaster services. In general, what barriers do you face in serving them? (Select all that apply)

This will create a comma separated list of the answers, and will not show "No Answer".

We don't currently have an "andlist()" function, but that would be easy to add, and is probably a good idea. That way it could automatically generate something like this:
problem B, problem C, AND problem D

The fixed survey is attached.

File Attachment:

File Name: limesurvey...7751.lss
File Size:27 KB
Attachments:

Please Log in to join the conversation.

More
4 years 8 months ago #86734 by ck2603
ck2603 replied the topic: Piping from Multiple Choice to Multiple Numerical
was trying to import the fixed survey but got the following error messages:

PHP Warning: simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: file:///H:/limesurvey/tmp/Sample%20Survey%20TestingPiping_fixed.lss:70: parser error : Input is not proper UTF-8, indicate encoding !
Bytes: 0xC2 0x20 0x20 0x57 in H:\limesurvey\admin\import_functions.php on line 1084
PHP Warning: simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: 1.� Which populations or groups do you think are underserved (or not reached w in H:\limesurvey\admin\import_functions.php on line 1084
PHP Warning: simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: ^ in H:\limesurvey\admin\import_functions.php on line 1084
PHP Notice: Trying to get property of non-object in H:\limesurvey\admin\import_functions.php on line 1090

What happened??

Please Log in to join the conversation.

More
4 years 8 months ago #86735 by TMSWhite
TMSWhite replied the topic: Piping from Multiple Choice to Multiple Numerical
I've never seen that error myself.

However, you can cut and paste the following into Q2 to get the same effect:
You indicated that {list(that.Q1.shown, Q1_other)} are underserved for disaster services. In general, what barriers do you face in serving them? (Select all that apply)

Please Log in to join the conversation.

More
4 years 8 months ago #86736 by ck2603
ck2603 replied the topic: Piping from Multiple Choice to Multiple Numerical
That's what I did at first and it didn't work. So I tried to import your survey and to see what's going on but wasn't successful either.

It seems that {list(that.Q1.shown, Q1_other)} was not in effect...

I am attaching the exported survey in which {list(that.Q1.shown, Q1_other)} didn't work.
Thanks.
Attachments:

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now