Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Designing Issue

  • Mastelew
  • Mastelew's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 days 20 hours ago #267707 by Mastelew
Designing Issue was created by Mastelew
Dear Limesurvey Community;
Greeting all;

I have faced trouble on the following issues that I need your cooperation.
 
I want to distribute 200 resumes developed as question on limesurvey to respondents. However, each respondent are required to see only 8 resumes that are allocated to them randomly. I have attached the code I try to use but not working as expected.

With regards

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 days 13 hours ago #267709 by holch
Replied by holch on topic Designing Issue
Hi! No need to post twice. If this is your first post in the forum, it needs to be approved by a moderator first before it shows up in the forum. We got a lot os spam lately.

As your title is "Designing issues" and this forum is called "Design issues", while the other one you posted is called "Installation & update issues" I will approve this one and delete the other one.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: Mastelew

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 days 11 hours ago #267712 by Joffm
Replied by Joffm on topic Designing Issue
What you sent is not a lss Export, but a small text file that you renamed to "*.lss". To confuse us?
Please, send the lss export.

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: Mastelew

Please Log in to join the conversation.

  • Mastelew
  • Mastelew's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 days 19 hours ago #267717 by Mastelew
Replied by Mastelew on topic Designing Issue
Thank you so much dear for your prompt response.

Exactly, it is my first time to be here. Hereunder is the attached file.

With regards,

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 days 18 hours ago - 4 days 17 hours ago #267718 by Joffm
Replied by Joffm on topic Designing Issue
Please, neither lsq nor lsg exports, only lss.

Reason:
lsq and lsg exports are language sensitive.
You can only import into a survey with the same base language.
So, to import your question or group we have to guess the base language, create a survey (create a group) to be able to import the export.

A lss export you just import.
Furthermore a lss export contains all survey wide settings that may be of importance.
So please, ease our life.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 4 days 17 hours ago by Joffm.
The following user(s) said Thank You: Mastelew

Please Log in to join the conversation.

  • Mastelew
  • Mastelew's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 days 15 hours ago #267720 by Mastelew
Replied by Mastelew on topic Designing Issue
Dear Joffm, sorry for the inconvenience!!

I have attached the LSS file below.

With regards;

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 days 13 hours ago #267721 by Joffm
Replied by Joffm on topic Designing Issue
Hi,
this is all?
Select and display 8 out of these questions?

You may use the "standard" procedure
  • Create two groups
  • Set the second group to "hidden ("condition: 0" on group level)
  • Insert 8 questions into the first group
  • Insert the rest into the second group.
  • ALL questions get the same "randomization group name"

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: Mastelew

Please Log in to join the conversation.

  • Mastelew
  • Mastelew's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 days 11 hours ago - 4 days 11 hours ago #267723 by Mastelew
Replied by Mastelew on topic Designing Issue
Thank you so much!!

This is not all the questions. Yes I want to randomly assign 8 to respondents.The total number of questions is 200. Just I deleted the remaining because there is restriction on the size of file to be uploaded. Since it is my first to use javascript, would you indicate me with some working sample of it.

Looking forward to hearing from you.



With regards,
Last edit: 4 days 11 hours ago by Mastelew. Reason: Some fault answer

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 days 9 hours ago #267725 by Joffm
Replied by Joffm on topic Designing Issue
Hi,

Since it is my first to use javascript,

I did not talk about javascript.
In your sample survey there was no script, and no script is needed.

Your sample is fine.
Here the structure
 
And G2 is hidden by condition. Just add the other 150 questions here.

You only have to enter the same "Randomization group name" to ALL questions (200).
 

File Attachment:

File Name: limesurvey...96_J.lss
File Size:799 KB

And I will not do this.


Of course you can consider a different approach.
If you insist in using javascript.
Use the previous scrip. This only selects 8 numbers out of 200.

Again all questions get the same randomization group name.
And you display the 8 questions by condition
Let's call the question of type "short text" where you inserted the script and got the string with the 8 selected numbers Q1.
The condition of the first question is: strpos(Q1,'-1-')>0
The condition of the second question is: strpos(Q1,'-2-')>0
The condition of the third question is: strpos(Q1,'-3-')>0
...
The condition of the 100. question is: strpos(Q1,'-100-')>0
...
The condition of the 200. question is: strpos(Q1,'-200-')>0

You CAN do that, but it is more unnecessary work.

And you can consider a third approach.
Again select the eight numbers by javascript, well the structure should be a bit different.
Store these 8 numbers in a question of type "multiple short text" with eight subquestions.
Like this.
Code:
<script type="text/javascript" charset="utf-8">
function shuffle(array) {
    var currentIndex = array.length, temporaryValue, randomIndex;
    // While there remain elements to shuffle...
    while (0 !== currentIndex) {
        // Pick a remaining element...
        randomIndex = Math.floor(Math.random() * currentIndex);
        currentIndex -= 1;
        // And swap it with the current element.
        temporaryValue = array[currentIndex];
        array[currentIndex] = array[randomIndex];
        array[randomIndex] = temporaryValue;
    }
    return array;
}
$(document).on('ready pjax:scriptcomplete',function(){
 
    // Fill the array, hier Zahlen von 1 - 200
    var arr = [];
    for (var i = 1; i < 201; i++) {
        arr.push(i);
    }
 
    arr = shuffle(arr);
    $('#question{QID} input[type="text"]:eq(0)').val(arr[0]);
    $('#question{QID} input[type="text"]:eq(1)').val(arr[1]);
    $('#question{QID} input[type="text"]:eq(2)').val(arr[2]);
    $('#question{QID} input[type="text"]:eq(3)').val(arr[3]);
    $('#question{QID} input[type="text"]:eq(4)').val(arr[4]);
    $('#question{QID} input[type="text"]:eq(5)').val(arr[5]);
    $('#question{QID} input[type="text"]:eq(6)').val(arr[6]);
    $('#question{QID} input[type="text"]:eq(7)').val(arr[7]);
    $('#question{QID}').hide();
});
</script>
In a question of type "huge text" you store all 200 definitions of the applicants like this
 
Now with the string functions "strpos()", and "substr()" you find the row and can insert the right text into the question.
This way you only need 8 questions insted of 200.

Joffm



 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • Mastelew
  • Mastelew's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 days 6 hours ago #267726 by Mastelew
Replied by Mastelew on topic Designing Issue
Thank you so much. I got a lot of perspective and input from you. I tried as per your direction, but it does not work both the randomisation and quota set.
For more information my question rests on the following picture taken from your response. Does all the question begin with Q1 or It should change accordingly like q2, q3, q4,,,,qn, which is replaced by Question ID or code. And how G2 (group 2) is hidden by condition?

with regards.


 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 days 6 hours ago #267727 by Joffm
Replied by Joffm on topic Designing Issue
And here another approach, based on my third solution.
You need only ONE single question.
 
Tomorrow I'll send the lss.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: Mastelew

Please Log in to join the conversation.

  • Mastelew
  • Mastelew's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 days 18 hours ago #267729 by Mastelew
Replied by Mastelew on topic Designing Issue
Many thanks dear Joffm!!

I wait for that.

With regards,

Mastelew

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose