Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: Piping from Multiple Choice to Multiple Numerical

Piping from Multiple Choice to Multiple Numerical 4 years 10 months ago #66705

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5984
  • Thank you received: 368
  • Karma: 260
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)limesurvey.org'"
The administrator has disabled public write access.

Piping from Multiple Choice to Multiple Numerical 4 years 3 months ago #79634

  • rvenkat
  • rvenkat's Avatar
  • Offline
  • Premium Lime
  • Posts: 44
  • Thank you received: 1
  • Karma: 2
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>
The administrator has disabled public write access.

Piping from Multiple Choice to Multiple Numerical 4 years 3 months ago #79636

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6212
  • Thank you received: 1376
  • Karma: 539
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.
The administrator has disabled public write access.

Piping from Multiple Choice to Multiple Numerical 4 years 3 months ago #79651

  • rvenkat
  • rvenkat's Avatar
  • Offline
  • Premium Lime
  • Posts: 44
  • Thank you received: 1
  • Karma: 2
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.
The administrator has disabled public write access.

Piping from Multiple Choice to Multiple Numerical 4 years 3 months ago #79653

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6212
  • Thank you received: 1376
  • Karma: 539
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.
The administrator has disabled public write access.

Piping from Multiple Choice to Multiple Numerical 4 years 3 months ago #79658

  • rvenkat
  • rvenkat's Avatar
  • Offline
  • Premium Lime
  • Posts: 44
  • Thank you received: 1
  • Karma: 2
Exported survey file is attached.

thanks very much.


File Attachment:

File Name: limesurvey...3932.lss
File Size:26 KB
The administrator has disabled public write access.

Piping from Multiple Choice to Multiple Numerical 4 years 3 months ago #79659

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6212
  • Thank you received: 1376
  • Karma: 539
...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.
The administrator has disabled public write access.

Piping from Multiple Choice to Multiple Numerical 4 years 3 months ago #79665

  • rvenkat
  • rvenkat's Avatar
  • Offline
  • Premium Lime
  • Posts: 44
  • Thank you received: 1
  • Karma: 2
Thank you so much!
It works now.



Ramesh
The administrator has disabled public write access.

Piping from Multiple Choice to Multiple Numerical 3 years 10 months ago #86700

  • ck2603
  • ck2603's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 9
  • Karma: 0
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!!!
The administrator has disabled public write access.

Piping from Multiple Choice to Multiple Numerical 3 years 10 months ago #86713

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6212
  • Thank you received: 1376
  • Karma: 539
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.
The administrator has disabled public write access.

Piping from Multiple Choice to Multiple Numerical 3 years 10 months ago #86725

  • ck2603
  • ck2603's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 9
  • Karma: 0
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
Last Edit: 3 years 10 months ago by ck2603. Reason: added in one more question
The administrator has disabled public write access.

Piping from Multiple Choice to Multiple Numerical 3 years 10 months ago #86733

  • TMSWhite
  • TMSWhite's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 758
  • Thank you received: 83
  • Karma: 37
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
The administrator has disabled public write access.

Piping from Multiple Choice to Multiple Numerical 3 years 10 months ago #86734

  • ck2603
  • ck2603's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 9
  • Karma: 0
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??
The administrator has disabled public write access.

Piping from Multiple Choice to Multiple Numerical 3 years 10 months ago #86735

  • TMSWhite
  • TMSWhite's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 758
  • Thank you received: 83
  • Karma: 37
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)
The administrator has disabled public write access.

Piping from Multiple Choice to Multiple Numerical 3 years 10 months ago #86736

  • ck2603
  • ck2603's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 9
  • Karma: 0
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:
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.292 seconds
Imprint                   Data Protection Statement                  Revocation information and revocation form