Welcome to the LimeSurvey Community Forum

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

Drag a shelf question

  • Mon2016
  • Mon2016's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 3 months ago #239645 by Mon2016
Drag a shelf question was created by Mon2016
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Survey theme/template:
==================
(Write here your question/remark)

Hello dear Forum,

I tell you about a problem that has caused me several headaches.

I tell you that I am carrying out a shelf-type survey (Conjoint) with several products and different prices as I show in the image.



There are 5 versions with 13 scenarios each where the interviewee simulates how many units he would buy of each product.

Now the dilemma is that there is a subsequent question (Q14) where it asks about the products mentioned in any of the scenarios, it must be applied for up to 3 products selected in the conjoint price scenarios, that is, if the interviewee in the exercise From the shelf simulation you selected 5 products, you should only ask for 3 random products and if you selected only 1,2 or 3, you only ask for those 3 products.

I hope someone can help me on this topic, I leave you a .lss file with a test of the survey that I am carrying out.

I also tell you that we have had problems with our server where we host our version Version 3.25.10+210128

For this survey we are working on the version Version 2.50+ Build 160414

Thank you very much to all and an affectionate greeting

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 3 months ago #239647 by holch
Replied by holch on topic Drag a shelf question

I also tell you that we have had problems with our server where we host our version Version 3.25.10+210128


This is already quite old and hasn't received any update since 28/01/2021, so almost 2 years without updates, bug and security fixes. This should be updated immediately.

For this survey we are working on the version Version 2.50+ Build 160414


Now this is ancient. First of all, this is the very first release of a really, really bad version of Limesurvey. In the months after the release there have been almost daily releases to fix all the bugs and issues with this version of Limesurvey. Personally, I never considered any of the Versions of the 2.5x branch as production ready. Now even the latest version of this branch isn't supported anymore. In my opinion, this version should not be used in a prodution environment at any time.

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

Please Log in to join the conversation.

More
1 year 3 months ago #239648 by Fran1991
Replied by Fran1991 on topic Drag a shelf question
Hello Holch,

I understand what you are telling me, but I have no other alternative than to take out this survey in this version since we have not been able to resolve the server issue.

We have even worked hard to make the project come out at the right time, which is why we decided to do it in this version.

I hope you can help me for the only occasion to get the project off the ground.

Greetings and thank you very much for your prompt response. :)
The following user(s) said Thank You: Mon2016

Please Log in to join the conversation.

  • Mon2016
  • Mon2016's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 3 months ago #239649 by Mon2016
Replied by Mon2016 on topic Drag a shelf question
:) :) :)

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 3 months ago #239650 by Joffm
Replied by Joffm on topic Drag a shelf question
Hi,
insert this group after your tasks

File Attachment:

File Name: limesurvey...2063.lsg
File Size:22 KB


You have to extend eqCount to all 20 codes and the default value of tString as well
(I only inserted 4 codes).
Then you will get up to 3 randomly selected values out of all mentioned products in
tString_1, tString_2, tString_3

Joffm

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

Please Log in to join the conversation.

  • Mon2016
  • Mon2016's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 2 months ago #239651 by Mon2016
Replied by Mon2016 on topic Drag a shelf question
Thank you very much, Joff

Always to the rescue of all of us.

I tell you that I already expanded to the 20 products of eqCount and tString as follows.



  eqCount:
{tArray_5=countifop(">","",Q4V1T01_5.NAOK,Q4V1T02_5.NAOK,Q4V1T03_5.NAOK,Q4V1T04_5.NAOK,Q4V1T05_5.NAOK,Q4V1T06_5.NAOK,Q4V1T07_5.NAOK,Q4V1T08_5.NAOK,_4V1T09,Q4V1T09 Q4V2T10_5.NAOK,Q4V2T11_5.NAOK,Q4V2T12_5.NAOK,Q4V2T13_5.NAOK)}
etc...

tString:
{list(if(!is_empty(tArray_1),"1",""),if(!is_empty(tArray_2),"2",""),if(!is_empty(tArray_3),"3","") ,if(!is_empty(tArray_4),"4",""),if(!is_empty(tArray_5),"5",""),if(!is_empty(tArray_6),"6",""),if (!is_empty(tArray_7),"7",""),if(!is_empty(tArray_8),"8",""),if(!is_empty(tArray_9),"9",""),if(! is_empty(tArray_10),"10",""),if(!is_empty(tArray_11),"11",""),if(!is_empty(tArray_12),"12",""),if(!is_empty( tArray_13),"13",""),if(!is_empty(tArray_14),"14",""),if(!is_empty(tArray_15),"15",""),if(!is_empty(tArray_16) ,"16",""),if(!is_empty(tArray_17),"17",""),if(!is_empty(tArray_18),"18",""),if(!is_empty(tArray_19)," 19",""),if(!is_empty(tArray_20),"20",""))}



Now my only question is what equation do I use to randomly sample P14 according to what was previously calculated?

I suppose that tString hosts the three random products but how to bring it to each question of Q14 so that it is displayed?

I attach again the lss with what has already been worked for a greater reception of the information

Thank you very much Joffm for your attention.

Moon

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 2 months ago #239652 by Joffm
Replied by Joffm on topic Drag a shelf question
Hi,
sorry, I sent a group that did not match my explanation.

Here the entire survey.
As you see you get a result of something like "#GBR"
To have only one character per product I changed to letters. (A=1, B=2, C=3, ...)

Now the relevance equation of your P14 groups is obvious:
If this string contains "A", display P1401, if it contains "B", display P1402, ...
You use the function "strpos(haystack,needle)"
The "#" at the beginning is to avoid an index of "0".
Unfortunately "0" is the index of the first character of the string, but also means "not found".

Now the relevance equation of
P1401 is "strpos(tString,"A")>0"
P1402 is "strpos(tString,"B")>0"
...
P1420 is "strpos(tString,"T")>0"

I only inserted into the first two groups. Rest ip to you.
And put all P14 groups into one randomization group
 

File Attachment:

File Name: limesurvey...5672.lss
File Size:1,498 KB



​​​​​​​But there is a different solution without this calculation but using the property ".relevanceStatus"
[url] forums.limesurvey.org/forum/installation...ct-3-out-of-8#222419 [/url]

Joffm

P.S. This text display question in GCalc is important.
Because you hide the equation and the array, but the string question by javascript, there wqill appear an empty screen with the navigation buttons.

And I had to change "valida", because it depended on a not existing question.

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

Please Log in to join the conversation.

  • Mon2016
  • Mon2016's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 2 months ago #240664 by Mon2016
Replied by Mon2016 on topic Drag a shelf question
Hello Joffm,

I apologize for responding so far, some modifications were made to the survey that I have worked on so far.

What you mention above works correctly, with 20 products, it randomly takes 4 products selected in the exercise from the shelf but now that more products have been added to this shelf (now there are 29) it doesn't take these 4 random products. I don't know if in this case the "tString" script changes because there are more products.




<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
       var astring= $('#question{QID} input[type="text"]').val();
       var arr = astring.split("");
       arr = shuffle(arr);
       arr = arr.slice(0,4).join('');
       $('#question{QID} input[type="text"]').val('#'+arr);
       $('#question{QID}').hide();
    });
</script>




How could I randomly show 4 products out of the 29 that I am showing to the interviewee?

I remind you that unfortunately we continue with Version 2.50+ Build 160414

I also attach the ssl survey with the calculation questions.

Thank you very much Joffm and an affectionate greeting <3

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 1 month ago #240678 by Joffm
Replied by Joffm on topic Drag a shelf question
Hi,
I do not see any issue,
EXCEPT
You hided the question tString by "Always hide this question".
Now this question is not existing in the DOM and therefore the javascript doesn't work.

In the javascript you saw the line
$('#question{QID}').hide();
This is used to hide the question.

Joffm

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

Please Log in to join the conversation.

  • Mon2016
  • Mon2016's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
1 year 1 month ago #240730 by Mon2016
Replied by Mon2016 on topic Drag a shelf question
Hello Joffm,

Thank you very much for your answer. You are very right hiding the question from the options box does not do what I want.

I already showed it and it does it perfectly.

But I have another issue, it seems to me that the script that I am inserting is correct but when I run my survey it shows me that variable and shows it blank. (attached image)




I don't know if in this case I am doing something wrong or if I am inserting the wrong script, I am also attaching the lss poll to see if it is possible that you could help me to detect the error, as you can see I am a bit bad for Java so it seems to me makes it difficult to find the issue :(

Thank you again for your valuable help.

I will always be grateful.

Greetings,

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 1 month ago #240735 by Joffm
Replied by Joffm on topic Drag a shelf question
Hi,
I wrote

P.S. This text display question in GCalc is important.
Because you hide the equation and the array, but the string question by javascript, there wqill appear an empty screen with the navigation buttons.

What happens in your group?
If ALL questions of a group are hidden by "Always hide..." the group is not displayed.
But in your group there is one question that is displayed, so the group is displayed.
This question is hidden by javascript directly after showing.
Therefore the skeleton of the group - the navigation buttons - are still visible.

And therefore I use the text display question.
Here some information about the next questions. Or whatever you want to tell your respondents.  

Display some feedback, let your respondents take a break, especially after the long - and a bit boring - shelf test.
Tell them what will come next.

Have a look at this
 

File Attachment:

File Name: surveyfriendly1.zip
File Size:977 KB


Joffm

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

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose