Welcome to the LimeSurvey Community Forum

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

Designing Issue

More
10 months 16 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.

More
10 months 8 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.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
The following user(s) said Thank You: Mastelew

Please Log in to join the conversation.

More
10 months 6 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.

More
9 months 4 weeks 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.

More
9 months 4 weeks ago - 9 months 4 weeks 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: 9 months 4 weeks ago by Joffm.
The following user(s) said Thank You: Mastelew

Please Log in to join the conversation.

More
9 months 4 weeks 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.

More
9 months 4 weeks 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.

More
9 months 4 weeks ago - 9 months 4 weeks 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: 9 months 4 weeks ago by Mastelew. Reason: Some fault answer

Please Log in to join the conversation.

More
9 months 4 weeks 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.38 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.

More
9 months 4 weeks 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.

More
9 months 4 weeks 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.

More
9 months 4 weeks 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.

More
9 months 4 weeks ago - 9 months 4 weeks ago #267731 by Joffm
Replied by Joffm on topic Designing Issue
Hi,
here the lss export
 

File Attachment:

File Name: limesurvey...59_J.lss
File Size:75.17 KB


Short explanation.
1. Create a structured text with the attributes of all 200 options,
 
You see, at the beginning a number to identify.
And all attributes start at the same column and have the same length
Enter this text as default value in the first question Q0 (huge text) (hidden)

2. Question QS (hidden by script) is a "multiple short text" question with 8 subquestions where you store the selectes eight numbers.
Here the already shown script is entered.

3. Info is just a placeholder. Here you enter your other questions of the beginning - or some information text about the next questions, or .... This is necessary.

4. SE is a "multiple short text" question (hidden) with 8 subquestions where you store the rows of Q0 that are selected. So it's just a help container.

5. eqSE is an equation (hidden) which uses the functions "strpos()" and "substr()" to find the selected rows and store them into this "container"

6. Q1 is your question of type "array(numbers)"
In the question text you create the table.
The values are inserted by ExpressionScript - again using the function "substr()".
And there is another script inserted, which defines the width of the columns.
 

Joffm

This is a simple solution, but it is a little more complex to analyze.
To compare the values ​​of the individual applicants, you have to restructure the response table.
But this is also quite easy, since you know exactly who was shown in each case (in QS, where is stored the number of the applicants)

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

Please Log in to join the conversation.

More
9 months 4 weeks ago #267735 by Mastelew
Replied by Mastelew on topic Designing Issue
Dear Joffm,Thank you for your tireless efforts to support researchers on this forum. I've gained so much from your guidance and expertise, and I truly appreciate it.To explain my approach, I'd like to use the structure I’ve attached below. My goal is to randomly display eight resumes in a single question group. To achieve this, I've organized my survey into 25 groups, with each group containing one question and eight answer choices for the eight resumes. This setup comes from the calculation 200/8=25200 / 8 = 25200/8=25.Additionally, I've included a condition in a separate group at the beginning of the survey. Each question group follows the same randomization setup and applies the condition I’ve established. Please refer to the attached “LSS” file, and I look forward to your feedback.Thank you once again, and I hope this will be my final question! With warm regards and deep appreciation
 

Please Log in to join the conversation.

More
9 months 4 weeks ago - 9 months 4 weeks ago #267736 by Joffm
Replied by Joffm on topic Designing Issue
Do, whatever you want.
You got enough examples.

Now you should be able to design your desired layout.

And read the manual about question types.
This last approach is really bad.
Maybe better
 
array(numbers)

Joffm

And I saw "slice(0,1)" in the script.
So youonly want to select one number.
In this case the whole script is obsolete.
A simple random number {if(is_empry(randnum),rand(1,4),randnum} is sufficient.
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 9 months 4 weeks ago by Joffm.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose