Piping Issue

More
4 years 6 months ago - 4 years 6 months ago #92319 by StuartMark0
StuartMark0 created the topic: Piping Issue
Hi LS,

I have been trying to get this piping in my survey, however either it pipes everything or nothing: for example:

Q1: Which of the following actions have you undertaken in your household?
A. Action1
B. Action2
C. Action3
D. Action4
E. Action5

Q2: (Instruction) - show list of actions answered in Q1.
How may actions have you seen it in XYZ's Advertisement?
A. Action1
B. Action2
C. Action3
D. Action4
E. Action5


If I have selected 2, 3, and 5 - I need to see only 2,35 in Q2 - however I cant get this right. Please help.

Thanks

Cheers,
Mark.
Last Edit: 4 years 6 months ago by StuartMark0. Reason: Further Explanation

Please Log in to join the conversation.

More
4 years 6 months ago #92332 by DenisChenu
DenisChenu replied the topic: Piping Issue
Hello,
Did you have a look at adanced settings / filter array attribute ?

docs.limesurvey.org/Question+type+-+Array#Array_filter

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
4 years 6 months ago #92436 by StuartMark0
StuartMark0 replied the topic: Piping Issue
Hi Denis,

Thanks for your reply, Apologies I was not detailed in my query.

Filter array works when it is a multiple choice which reads the data as Yes/No - however what I had was three point scale viz:

Q1: Which of the following actions have you undertaken in your household?
A. Action1 Yes No Not relevant for me
B. Action2 Yes No Not relevant for me
C. Action3 Yes No Not relevant for me
D. Action4 Yes No Not relevant for me
E. Action5 Yes No Not relevant for me

Q2: (Instruction) - show list of actions answered 'YES' in Q1.
How may actions have you seen it in XYZ's Advertisement?
A. Action1
B. Action2
C. Action3
D. Action4
E. Action5

Here, I would like to pipe statements which were selected as YES and I do not want to pipe statements which were 'No' and 'Not relevant for me'.


How do I solve this?

Cheers,
Mark.

Please Log in to join the conversation.

More
4 years 6 months ago #92445 by DenisChenu
DenisChenu replied the topic: Piping Issue
Oh,

You're right, actually there are no automatic system to do this.

Sometimes i use a javascript way:
Add a Q1bis question : multi check.
Add a javascript to check/uncheck "corresponding Multi checking on Q1bis from Q1"
Filter array by Q1bis.

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
4 years 6 months ago #92522 by StuartMark0
StuartMark0 replied the topic: Piping Issue
Hi Denis,

Thanks for your help so far.

I am beginner to Java scripting & LS, will you be able to share if you have that check/uncheck script handy?

It will be a great help.

Cheers,
Mark.

Please Log in to join the conversation.

More
4 years 6 months ago - 4 years 6 months ago #92532 by DenisChenu
DenisChenu replied the topic: Piping Issue
Hello,

Quick way:
Multi hidden
 
<script charset="utf-8" type="text/javascript">
$(function() {
  // $("question{QID}").hide();
  $("#javatbd{Q1_A1.SGQA}").click(function(){
    if($("[name='{Q1_A1.SGQA}']:checked").val()=="YES"){
      $("#answer{Q1bis_A1.SGQA}").attr("checked","checked");
    }else{
      $("#answer{Q1bis_A1.SGQA}").removeAttr("checked");
    }
      $("#answer{Q1bis_A1.SGQA}").triggerHandler("click");
  });
  $("#javatbd{Q1_A2.SGQA}").click(function(){
    if($("[name='{Q1_A2.SGQA}']:checked").val()=="YES"){
      $("#answer{Q1bis_A2.SGQA}").attr("checked","checked");
    }else{
      $("#answer{Q1bis_A2.SGQA}").removeAttr("checked");
    }
      $("#answer{Q1bis_A2.SGQA}").triggerHandler("click");
  });
  $("#javatbd{Q1_A2.SGQA}").click(function(){
    if($("[name='{Q1_A2.SGQA}']:checked").val()=="YES"){
      $("#answer{Q1bis_A2.SGQA}").attr("checked","checked");
    }else{
      $("#answer{Q1bis_A2.SGQA}").removeAttr("checked");
    }
      $("#answer{Q1bis_A2.SGQA}").triggerHandler("click");
  });
});
</script>

See lss file

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Last Edit: 4 years 6 months ago by DenisChenu.

Please Log in to join the conversation.

More
4 years 6 months ago #92533 by DenisChenu
DenisChenu replied the topic: Piping Issue

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
4 years 6 months ago #92648 by StuartMark0
StuartMark0 replied the topic: Piping Issue
Hi Denis,

Thanks for the script, I have understood the logic however I am not able to get this working so far, will you be able help me with the syntax?

Multi hidden <script charset="utf-8" type="text/javascript">
$(function() {
// $("question{3121}").hide();

$("#javatbd{131384X198X2942ber1_A1}").click(function(){
if($("[name='{131384X198X2942ber1_A1}']:checked").val()=="YES"){
$("#answer{131384X198X3121ber1}").attr("checked","checked");
}else{
$("#answer{131384X198X3121ber1}").removeAttr("checked");
}
$("#answer{131384X198X3121ber1}").triggerHandler("click");
});


$("#javatbd{131384X198X2942ber2_A1}").click(function(){
if($("[name='{131384X198X2942ber2_A1}']:checked").val()=="YES"){
$("#answer{131384X198X3121ber2}").attr("checked","checked");
}else{
$("#answer{131384X198X3121ber2}").removeAttr("checked");
}
$("#answer{131384X198X3121ber2}").triggerHandler("click");
});


$("#javatbd{131384X198X2942ber3_A1}").click(function(){
if($("[name='{131384X198X2942ber3_A1}']:checked").val()=="YES"){
$("#answer{131384X198X3121ber3}").attr("checked","checked");
}else{
$("#answer{131384X198X3121ber3}").removeAttr("checked");
}
$("#answer{131384X198X3121ber3}").triggerHandler("click");
});

});
</script>



ber1 = Action 1
ber2 = Action 2
ber3 = Action 3

A1 = Yes
A2 = No
A3 = Not relevant for me.

Thanks a million.

Cheers,
VP

Please Log in to join the conversation.

More
4 years 6 months ago - 4 years 6 months ago #92650 by DenisChenu
DenisChenu replied the topic: Piping Issue
Hello,

Replace the 131384X198X2942 and 131384X198X3121 by the questions code.

Look at Expression Manager doc.

And the lss file is here: www.sondages.pro/IMG/lss/limesurvey_surv...rayfilter-script.lss

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Attachments:
Last Edit: 4 years 6 months ago by DenisChenu.

Please Log in to join the conversation.

More
4 years 6 months ago #92660 by tpartner
tpartner replied the topic: Piping Issue
This thread about using a hidden multiple-options to filter subsequent questions may be of some help - www.limesurvey.org/en/forum/can-i-do-thi...nditional-list#92604

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 6 months ago - 4 years 6 months ago #92708 by StuartMark0
StuartMark0 replied the topic: Piping Issue
Thanks Guys, It helped.

Now, I am stuck on next one.

I am trying to add Array drop down question with three columns.
Drop Down Texts
Drop downs:
Usage
• Morning (i.e. before 8:00am)
• During the day (i.e. between 8:00am and 5:00pm)
• Night (i.e. after 5:00pm)
Travel Mode
• Drive
• Walk
• Other
Time Taken to Travel
• Less than 5 minutes
• 5 to 10 minutes
• 10 to 15 minutes
• 15 to 20 minutes
• More than 20 minutes


I need to add these DROP DOWNS for 7 different services in asked in row.

1. Service 1 <Drop down Time of the day><Travel Mode><Time taken to Travel>
2. Service 1 <Drop down Time of the day><Travel Mode><Time taken to Travel>1.
3. Service 1 <Drop down Time of the day><Travel Mode><Time taken to Travel>
so on and so forth

I am able to get the Drop downs but without the TEXT. I am using Array number question type.


Here's the Work in Progress - script

$(document).ready(function(){

$('#question3152 .answer_cell_1 option[value=1]').text('Morning (i.e. before 8:00am)');
$('#question3152 .answer_cell_1 option[value=2]').text('During the day (i.e. between 8:00am and 5:00pm)');
$('#question3152 .answer_cell_1 option[value=3]').text('Night (i.e. after 5:00pm)');

$('#question3152 .answer_cell_2 option[value=1]').text('Drive');
$('#question3152 .answer_cell_2 option[value=2]').text('Walk');
$('#question3152 .answer_cell_2 option[value=3]').text('Other');

$('#question3152 .answer_cell_3 option[value=1]').text('Less than 5 minutes');
$('#question3152 .answer_cell_3 option[value=2]').text('5 to 10 minutes');
$('#question3152 .answer_cell_3 option[value=3]').text('10 to 15 minutes');
$('#question3152 .answer_cell_3 option[value=4]').text('15 to 20 minutes');
$('#question3152 .answer_cell_3 option[value=5]').text('more than 20 minutes');
$('#question3152 .answer_cell_3 option[value=6]').text('').hide();


Can you help me to get this script working?

Thanks guys

Cheers,
Mark.
Last Edit: 4 years 6 months ago by StuartMark0. Reason: emphasis

Please Log in to join the conversation.

Did you already participate in our customer survey?

Don't miss your chance for great prices.

Please click here to participate:

Start now

Start now!

Just create your account and start using Limesurvey today.

Register now