Welcome, Guest
Username: Password: Remember me

TOPIC: Column Piping Issue

Column Piping Issue 9 months 2 weeks ago #100466

I have followed the tutorial here: manual.limesurvey.org/Workarounds:_Manip...ime_using_Javascript
(Filter "Array by Column" Question With "Multiple-Options")

I cannot get this working. I have an urgent need to fix this for a large national company survey.

The first question is multiple choice (5-options). The second question is a Numerical Array (using checkboxes, for multiple select) and I need to pipe the answers chosen in the multiple-choice question to the columns (x-axix, horizontal) choices in the array. I need ONLY the ones chosen to show. I had it working so that all would show but then 2 or 3 column titles would be blank and still show checkboxes.

Can someone please help me with the correct javascript to use, where and how?

Please see image which shows the two questions.

Thank you!
Dawna
Attachments:
The administrator has disabled public write access.

Column Piping Issue 9 months 2 weeks ago #100472

  • holch
  • holch's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2549
  • Thank you received: 285
  • Karma: 102
If you could put this into the vertical item list on the left (so switch the axis) the solution would be very simple: array_filter. I don't know if the array filter is available for the way you want to use it.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.

Column Piping Issue 9 months 2 weeks ago #100473

  • holch
  • holch's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2549
  • Thank you received: 285
  • Karma: 102
Seems like the array filter is also available for the array by column option:

manual.limesurvey.org/Question_type_-_Ar...r_.28array_filter.29
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.

Column Piping Issue 9 months 2 weeks ago #100477

Thanks but I need to use array (numbers) using checkboxes for Q2 and I need the columns to be piped in. I know it can be done as there is a tutorial on it, but it might be for an older version of LimeSurvey. I am hoping a Javascript Expert like Tony P. will know some quick JS code to do what I need.

Thanks though.
Dawna
The administrator has disabled public write access.

Column Piping Issue 9 months 2 weeks ago #100478

I have tried this about 100 different ways and I am close. If someone knows some javascript to hide the empty columns (with no labels), I would be all set. This is due on Monday so I would GREATLY appreciate it.

I am attaching a copy of the survey.

Thanks.
Dawna
Attachments:
The administrator has disabled public write access.

Column Piping Issue 9 months 2 weeks ago #100521

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4050
  • Thank you received: 739
  • Karma: 341
Add this script to the source of the array question. It will loop through all of the column headers and, if found to be empty, will hide all answer cells in that column.

<script type="text/javascript" charset="utf-8">	
	$(document).ready(function() {
 
		$('#question{QID} .subquestions-list thead th').each(function(i) {
			if($.trim($(this).text()).length == 0) {
				var colIndex = i;
				$(this).hide();
				$('#question{QID} .questions-list').each(function() {
					$('.question-item:eq('+colIndex+')', this).hide();
				});
			}
		});
	});
</script>
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.
The administrator has disabled public write access.
The following user(s) said Thank You: wireframemedia

Column Piping Issue 9 months 2 weeks ago #100523

Thanks Tony, that worked like a charm!
Exactly what I needed.
Great support as usual.

Take care.
Dawna
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.132 seconds
Donation Image