- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Capturing randomization order
- itsdanwall
- Topic Author
- Offline
- New Member
Less
More
10 years 4 months ago #102039
by itsdanwall
Capturing randomization order was created by itsdanwall
I am trying to determine if the question order and the order of answer options for the attached survey. There is randomization on which side each answer option is presented (via the "Random order: Randomize on each page load" within the question options). Further the questions themselves are presented in a random order (via the "Randomization group" within the question group options). I would like to be able to capture both the side of the answer options were presented on and the order which the questions were presented. Is there a way to do this in LimeSurvey?
Note: I used the "copy_of_default.zip" template to make List(radio) questions appear horizontally.
Note: I used the "copy_of_default.zip" template to make List(radio) questions appear horizontally.
Attachments:
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11658
- Thank you received: 2742
10 years 4 months ago #102047
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Capturing randomization order
without having had a look at your files, I'd say no, not out of the box. At least I am not aware of any feature like this.
Maybe one can do something with Javascript writing the order into a hidden question field, but I think this will be quite complicated.
Would be great if anyone could proof me wrong though...
But this would probably require an additional column in the database for each question and each answer item, which would bring us quickly to the column limits of the database engines, especially for bigger surveys and/or long item lists, where the randomization is most important.
Maybe one can do something with Javascript writing the order into a hidden question field, but I think this will be quite complicated.
Would be great if anyone could proof me wrong though...
But this would probably require an additional column in the database for each question and each answer item, which would bring us quickly to the column limits of the database engines, especially for bigger surveys and/or long item lists, where the randomization is most important.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- itsdanwall
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
10 years 4 months ago #102334
by itsdanwall
Replied by itsdanwall on topic Capturing randomization order
Do you know of any resources for me to begin to understand how to use JavaScript to write the random order to a hidden question field?
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11658
- Thank you received: 2742
10 years 4 months ago #102345
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Capturing randomization order
Sorry, I am not a Javascript expert.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
10 years 4 months ago - 10 years 4 months ago #102364
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Capturing randomization order
To record the group display order, you can add a hidden
equation type question
to each group and load it with the equation below. This records the
sequential number of the group
(I have added 1 so the sequence starts at 1)
Recording the radio answer order is a little trickier...
1) Set up your survey to use JavaScript .
2) Add a short-text question to each group (we'll hide them with JavaScript).
3) Add the following script to the source of each short-text. This script:
- Hides the short-text question
- Loops through the radio options as displayed
- Records a comma-separated list of their answer IDs in the short-text
Here's your sample survey back with these modifications:
Code:
{self.gseq + 1}
Recording the radio answer order is a little trickier...
1) Set up your survey to use JavaScript .
2) Add a short-text question to each group (we'll hide them with JavaScript).
3) Add the following script to the source of each short-text. This script:
- Hides the short-text question
- Loops through the radio options as displayed
- Records a comma-separated list of their answer IDs in the short-text
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ // Identify some stuff var qHiddenID = {QID}; // The hidden question ID var qHidden = $('#question'+qHiddenID); // The hidden question var q1 = $('div.list-radio:eq(0)'); // First radio question on the page var q1ID = $(q1).attr('id').split('question')[1]; // The first radio question ID var gID = $('input.text', qHidden).attr('id').split('X')[1]; // The group ID // Hide this question $(qHidden).hide(); // Build an array of the Q1 answers var answersArr = new Array(); $('input.radio', q1).each(function(i){ var answerID = $(this).attr('id').split('X'+gID+'X'+q1ID)[1]; answersArr.push(answerID); }); // Load the array into the hidden question $('input.text', qHidden).val(answersArr); }); </script>
Here's your sample survey back with these modifications:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
Last edit: 10 years 4 months ago by tpartner.
The following user(s) said Thank You: first
The topic has been locked.
- Marv12
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
6 years 7 months ago #158449
by Marv12
Replied by Marv12 on topic Capturing randomization order
Hi,
what is gseq and what is self in this case?
what is gseq and what is self in this case?
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12925
- Thank you received: 3977
6 years 7 months ago - 6 years 7 months ago #158464
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Capturing randomization order
Hello, Marv,
no crossposts please.
But to answer:
If your equation has code "eq1", the term "self.gseq" is identical to "eq1.gseq".
This is what you see on the screen and is described in the manual
manual.limesurvey.org/Expression_Manager....27that.27_variables
Joffm
no crossposts please.
But to answer:
If your equation has code "eq1", the term "self.gseq" is identical to "eq1.gseq".
This is what you see on the screen and is described in the manual
manual.limesurvey.org/Expression_Manager....27that.27_variables
The 'this' variable is used exclusively within the "Whole question validation equation" and "Sub-question validation equation" advanced question options. It expands to the variable names of each of the cells within those questions.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 6 years 7 months ago by Joffm.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
6 years 7 months ago #158465
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Capturing randomization order
1) self refers to the question.
2) gsec is "the sequential number of the group, starting from 0" - manual.limesurvey.org/Expression_Manager#Access_to_Variables
2) gsec is "the sequential number of the group, starting from 0" - manual.limesurvey.org/Expression_Manager#Access_to_Variables
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- DenisChenu
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13645
- Thank you received: 2491
6 years 7 months ago #158492
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Capturing randomization order
Else : existing plugin
framagit.org/SondagePro-LimeSurvey-plugin/getQuestionOrder
working on 2.6lts version, not tested with 2.5X but think it can work
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- markusfluer
- Visitor
6 years 7 months ago - 6 years 7 months ago #158771
by markusfluer
Replied by markusfluer on topic Capturing randomization order
To capture the sequence it would be better to create a hidden short text question and put {self.gseq}as default value.
Or {self.gseq+1} to have non zero based counting.
Or {self.gseq+1} to have non zero based counting.
Last edit: 6 years 7 months ago by markusfluer.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
6 years 7 months ago #158787
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Capturing randomization order
Yep, I believe that's what I said above regarding group randomizations -
www.limesurvey.org/forum/can-i-do-this-w...ization-order#102364
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- DenisChenu
- Away
- LimeSurvey Community Team
Less
More
- Posts: 13645
- Thank you received: 2491
6 years 7 months ago #158812
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Capturing randomization order
My plugin save all in one question : nananananére
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.