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

TOPIC: HowTo Filter the Columns of an Array (Numbers)

HowTo Filter the Columns of an Array (Numbers) 2 years 1 month ago #109458

  • scottturnbull
  • scottturnbull's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 10
  • Thank you received: 1
  • Karma: 0
Is there a way in the LimeSurvey dialogs to control the visibility of columns in an array (numbers) question?

I am working on implementing a survey in which a set of actions is presented in a multi choice list.
i.e.
"Select the following types of communication you participate in with one or more of your contacts."

A subsequent question will present a lengthy list of contacts, and ask that the participant mark which communication actions are engaged in with each contact.

This is being created as questions of type Array (numbers) with the checkbox option enabled. The desired result is a grid of checkboxes with communication types as columns and contacts as the rows.

We would like the list of actions from the setup question to be used as an array filter for the columns of the array numbers question type. Only those actions that the participant stated they sometimes use would be shown as a checkbox option for each listed contact.

I can easily manage using an array filter from a previous question to control display of array (numbers) rows, but I haven't found a way to have an array filter control array (numbers) columns.

To restate my opening question,
Is there a way in the LimeSurvey dialogs, or is a bit of custom javascript the only way to hide columns based on previous answer values?
The administrator has disabled public write access.

HowTo Filter the Columns of an Array (Numbers) 2 years 1 month ago #109462

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6129
  • Thank you received: 1360
  • Karma: 535
You will need to use JavaScript for that.

For inspiration - manual.limesurvey.org/Workarounds:_Manip...2Multiple-Options.22.


.
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.
The following user(s) said Thank You: scottturnbull

HowTo Filter the Columns of an Array (Numbers) 2 years 1 month ago #109464

  • Bigred
  • Bigred's Avatar
  • Offline
  • Senior Lime
  • Posts: 70
  • Thank you received: 27
  • Karma: 5
I read in a previous forum post that someone created a multiple choice question for each column then by using float left on them, they lined them up side by side. (I wish i could find a link to point you to it..If i do i will add it to this post)

The answer options were also in a multiple choice question with the same amount of options but the checkboxes were hidden. The text lined up with all of the other questions.

Instead of using the array filter, you can set the relevance for each "column"(question) separately.

This approach would allow you to use all of the built in limesurvey exclusive options available for multiple choice questions but will involve some styling on your part to get it looking right.

If you do it like this though you will probably want a fixed question width so the columns wont stack when the window is resized or the respondent has a low resolution.
The administrator has disabled public write access.
The following user(s) said Thank You: scottturnbull

HowTo Filter the Columns of an Array (Numbers) 2 years 1 month ago #109893

  • scottturnbull
  • scottturnbull's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 10
  • Thank you received: 1
  • Karma: 0
I was hoping I had simply missed the combination of dialog knobs that would give control of column visibility.

As with many such projects, the requirements shift, and the need to hide the columns has faded away. It was a worthy exercise in use of techniques for the javascript merging of multiple questions into a single composite question on the screen. I'll tuck the technique into my toolbox for use another day.

Thanks, all.
The administrator has disabled public write access.

HowTo Filter the Columns of an Array (Numbers) 3 months 5 days ago #135099

  • OMdev
  • OMdev's Avatar
  • Offline
  • Platinum Lime
  • Posts: 326
  • Thank you received: 34
  • Karma: 15
Bigred wrote:
I read in a previous forum post that someone created a multiple choice question for each column then by using float left on them, they lined them up side by side. (I wish i could find a link to point you to it..If i do i will add it to this post)

I tried it some time but demo survey was hosted on limeservice which is not expired. Anyway i will try to rewrite the code and share.

You can find this thread quickly remembering it as first thread in plugins folder :)

www.limesurvey.org/forum/plugins/95000-c...nd-exclusive-options
Survey Designer and Programmer
"I always suggest to have a group by group display layout and create a seprate group for each question. This will be extra work but you will get flexiblity to create your question by using more than more lime survey question types."
The administrator has disabled public write access.

HowTo Filter the Columns of an Array (Numbers) 3 months 5 days ago #135102

  • OMdev
  • OMdev's Avatar
  • Offline
  • Platinum Lime
  • Posts: 326
  • Thank you received: 34
  • Karma: 15
Its almost done. You may need to adjust some look and feel or maybe tpartner will help us to extend this script so that it works without any modification.

#We create as many multi questions as we need columns.
#The move those column side by side with float left.
#Adjust labels.

Benefits:
#You can hide columns with relevance.
#Sub-question relevance will still work.
#You can make use advance setting that are multi choice question.

File Attachment:

File Name: limesurvey...3985.lss
File Size:37 KB


Tested with Version 2.06+ Build 150612 default template.
Survey Designer and Programmer
"I always suggest to have a group by group display layout and create a seprate group for each question. This will be extra work but you will get flexiblity to create your question by using more than more lime survey question types."
The administrator has disabled public write access.

HowTo Filter the Columns of an Array (Numbers) 3 months 4 days ago #135109

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 9281
  • Thank you received: 1324
  • Karma: 384
Assistance on LimeSurvey forum and LimeSurvey core developpement are on my free time (Say thanks ?).
A bug not reported is a bug not corrected. | Please, read the documentation | La doc en français à besoin de vous
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.249 seconds
Imprint                   Data Protection Statement                  Revocation information and revocation form