- Posts: 26
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Array by column
- acasadei90CRT
- Topic Author
- Offline
- Junior Member
Less
More
5 years 2 months ago #180974
by acasadei90CRT
Array by column was created by acasadei90CRT
Hi community,
I'm trying to create an array by column question but I have found two problems:
1) I would like to hide the question if the previous one has not been completed. I can't find the relevance field where I wanted to write --> !is_empty(team01) --> where team01 is the code of the previous question.
2) I have several predefined subquestions. But i would like to show just a number of those equal to the answer of the previous question.
eg. If the answer of the previous question is 3 i would like to see just only 3 rows in the array question.
I have set the following settings (attachment) but it doesn't work.
Thanks in advance for any kind of contribution.
Best Regards
Andrea
I'm trying to create an array by column question but I have found two problems:
1) I would like to hide the question if the previous one has not been completed. I can't find the relevance field where I wanted to write --> !is_empty(team01) --> where team01 is the code of the previous question.
2) I have several predefined subquestions. But i would like to show just a number of those equal to the answer of the previous question.
eg. If the answer of the previous question is 3 i would like to see just only 3 rows in the array question.
I have set the following settings (attachment) but it doesn't work.
Thanks in advance for any kind of contribution.
Best Regards
Andrea
Attachments:
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12933
- Thank you received: 3979
5 years 2 months ago #180976
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Array by column
Hi, Andrea,
please, send a sample file with just these questions.
What is your array by column?
And what type of question is team01? In your subquestion relevance it looks like numerical input.
Joffm
please, send a sample file with just these questions.
What is your array by column?
And what type of question is team01? In your subquestion relevance it looks like numerical input.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- acasadei90CRT
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 26
- Thank you received: 0
5 years 2 months ago #180978
by acasadei90CRT
Replied by acasadei90CRT on topic Array by column
Goodmorning Joffm,
In the attachment I have tried to add the third question, which has those features that I had already described before.
I would like to hide that question if the respondent hasn't answered the first question yet.
I also would like to reduce the number of columns, based on the first question's answer.
Best Regards,
Andrea
In the attachment I have tried to add the third question, which has those features that I had already described before.
I would like to hide that question if the respondent hasn't answered the first question yet.
I also would like to reduce the number of columns, based on the first question's answer.
Best Regards,
Andrea
Attachments:
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12933
- Thank you received: 3979
5 years 2 months ago #180980
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Array by column
Hi,
I do not understand why you use an array by column.
In my opinion this is better understandable.
example:
And what so you think about this?
example:
I do not understand why you use an array by column.
In my opinion this is better understandable.
example:
And what so you think about this?
example:
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- acasadei90CRT
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 26
- Thank you received: 0
5 years 2 months ago #180981
by acasadei90CRT
Replied by acasadei90CRT on topic Array by column
Thank you very much for your answer.
The second solution would be perfect (really good-looking form), but I'm not able to make the multiple choice option in the last column.
I will follow your first solution at the moment.
Best Regards
Andrea
The second solution would be perfect (really good-looking form), but I'm not able to make the multiple choice option in the last column.
I will follow your first solution at the moment.
Best Regards
Andrea
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12933
- Thank you received: 3979
5 years 2 months ago #180982
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Array by column
Hi,
in the question text - in source code mode - there is:
And in "Display / css classes": with-checkbox-array-comments
In this example the x-axis has codes "X001", X002", "X003". "X004"
You have to adapt the script to your needs.
Joffm
in the question text - in source code mode - there is:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ var thisQuestion = $('#question{QID}'); // Insert selects $('.answer-item.answer_cell_X004', thisQuestion).addClass('with-select').append('<select class="inserted-select form-control list-question-select">\ <option value="">Please choose...</option>\ <option value="1">High school diploma</option>\ <option value="2">Degree</option>\ <option value="3">PhD</option>\ <option value="4">Master</option>\ </select>'); // Listeners $('.inserted-select', thisQuestion).on('change', function(i) { if($(this).val() != '') { $(this).closest('.answer-item').find('input:text').val($.trim($('option:selected', this).text())).trigger('change'); } else { $(this).closest('.answer-item').find('input:text').val('').trigger('change'); } }); // Returning to page $('.with-select input:text', thisQuestion).each(function(i) { var thisCell = $(this).closest('.answer-item'); var inputText = $.trim($(this).val()); var selectval = $('select.inserted-select option', thisCell).filter(function () { return $(this).html() == inputText; }).val(); $('select.inserted-select', thisCell).val(selectval); }); // Clean-up styles $('select.inserted-select', thisQuestion).css({ 'max-width': '100%' }); $('.with-select input:text', thisQuestion).css({ 'position': 'absolute', 'left': '-9999em' }); }); </script>
And in "Display / css classes": with-checkbox-array-comments
In this example the x-axis has codes "X001", X002", "X003". "X004"
You have to adapt the script to your needs.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: acasadei90CRT
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12933
- Thank you received: 3979
5 years 2 months ago #180985
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Array by column
Hi, another nice option.
Both grids open one row after the other up to the maximum and the name is displayed in the second grid.
Set subquestions and subquestion relevance to:
and the question relevance of the second grid to:
(!is_empty(PartDetail_SQ001_SQ001)) and (!is_empty(PartDetail_SQ001_SQ002)) and (!is_empty(PartDetail_SQ001_SQ003))
example:
Joffm
Both grids open one row after the other up to the maximum and the name is displayed in the second grid.
Set subquestions and subquestion relevance to:
and the question relevance of the second grid to:
(!is_empty(PartDetail_SQ001_SQ001)) and (!is_empty(PartDetail_SQ001_SQ002)) and (!is_empty(PartDetail_SQ001_SQ003))
example:
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: acasadei90CRT
The topic has been locked.
- acasadei90CRT
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 26
- Thank you received: 0
5 years 2 months ago #181007
by acasadei90CRT
Replied by acasadei90CRT on topic Array by column
Hi Joffm
Thank you very much for your last message.
I really appreciated your solution. I also have learnt how to use the answers of the previous questions in the following one (your solution for using name and surname instead the general term Participant _ is perfect for my purposes).
I would like to ask you if there is the possibility to create a kind of table that the respondent has to compile but with the possibility to add a new line by himself. I thought to use your last solution where the new line appears when the previous one was fully completed, but in that way i have to set a maximum predefined number of rows and I can't know it in advance.
Best Regards
Andrea
Thank you very much for your last message.
I really appreciated your solution. I also have learnt how to use the answers of the previous questions in the following one (your solution for using name and surname instead the general term Participant _ is perfect for my purposes).
I would like to ask you if there is the possibility to create a kind of table that the respondent has to compile but with the possibility to add a new line by himself. I thought to use your last solution where the new line appears when the previous one was fully completed, but in that way i have to set a maximum predefined number of rows and I can't know it in advance.
Best Regards
Andrea
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12933
- Thank you received: 3979
5 years 2 months ago - 5 years 2 months ago #181024
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Array by column
Hi,
yes, you have to define a maximum number.
There are several topics here about the lack of loops in LS. But inventing loops would need a real restructuring of the database.
So, you can do it like this:
Create a grid with a number of subquestions that will not be reached in a real interview. (e,g, 50)
In the subquestion relevance of each row set: "if the row before was filled"
In this case it is not necessary to enter the number of participants before.
Example:
Joffm
yes, you have to define a maximum number.
There are several topics here about the lack of loops in LS. But inventing loops would need a real restructuring of the database.
So, you can do it like this:
Create a grid with a number of subquestions that will not be reached in a real interview. (e,g, 50)
In the subquestion relevance of each row set: "if the row before was filled"
In this case it is not necessary to enter the number of participants before.
Example:
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 5 years 2 months ago by Joffm.
The topic has been locked.
- acasadei90CRT
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 26
- Thank you received: 0
5 years 1 month ago #181033
by acasadei90CRT
Replied by acasadei90CRT on topic Array by column
Hi,
I will follow your last suggestion in order to create a similar structure in my survey.
I was looking at the relevance section. I have found very useful your solution about the possibility to hide the question or subquestion if the previous one was empty.
I was wondering if there were the possibility to do the same thing with a one choice question. For example:
Q001. What is your job situation?
a) Student
b) Worker
Now i would like to show a second question if the respondent has chosen the option b)
Is there a way to set the second question's relevance field in order to do it, without using a programming language?
Best Regards,
Andrea
I will follow your last suggestion in order to create a similar structure in my survey.
I was looking at the relevance section. I have found very useful your solution about the possibility to hide the question or subquestion if the previous one was empty.
I was wondering if there were the possibility to do the same thing with a one choice question. For example:
Q001. What is your job situation?
a) Student
b) Worker
Now i would like to show a second question if the respondent has chosen the option b)
Is there a way to set the second question's relevance field in order to do it, without using a programming language?
Best Regards,
Andrea
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12933
- Thank you received: 3979
5 years 1 month ago - 5 years 1 month ago #181036
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Array by column
Question relevance means "This question is displayed if the condition is true"
What do you want?
Show the second question, if in Q001 "option b" was selected.
Q001=="Code of option b"
Best regards
Joffm
What do you want?
Show the second question, if in Q001 "option b" was selected.
Q001=="Code of option b"
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 5 years 1 month ago by Joffm.
The topic has been locked.