Welcome to the LimeSurvey Community Forum

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

Take those marked in a multiple question.

More
2 years 2 months ago #244496 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 everyone,
I hope you are fine.
I tell you that I am asking a question with several marks that I hosted in a multiple choice question.

Q13a.. Where have you bought clothes/shoes IN THE LAST SIX MONTHS?

In this question I have 47 possible marks.

Now the dilemma is which of those brands you mentioned that you buy in the last 6 months. I must ask

Q21. Considering the ideal for you, which of the following aspects does it meet (brand selected in Q13a)

This question shows several phrases that they should select based on their perception of the brand-


So create a sticky question for each brand and from there only show the ones you selected in Q13a. But when I want to activate my survey, it tells me that there are too many sub-questions, so my solution is to only have 10 fixed variables and show the ones that I have selected in Q13a, only I don't know how to do it.


That is, I do not think that a participant has bought clothes in more than 10 different places in the last 6 months

So I'd like to just have 10 fixed variables and pull the ones I mentioned in Q13a to reduce the size of my survey.


Does anyone have an idea how I can do this?

I am attaching an example of my survey on lss to make it a bit more clear.

:(

My versión LS is: Versión 3.25.10+210128

I thank you very much.

Greetings,

Please Log in to join the conversation.

More
2 years 2 months ago #244499 by holch
I don't really understand the description of the issue, it is a little confusing. I'll try to import your survey and see if I can understand it when looking at your survey.

Off topic:

My versión LS is: Versión 3.25.10+210128


Your version is from 28/01/2021, so 2,5 years old and hasn't received any updates, bug fixes or security patches since then. Considering that Limesurvey is a data collection platform and you responsibility to keep the information provided to you save, you should really update your installation on a regular basis.

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.

Please Log in to join the conversation.

More
2 years 2 months ago #244500 by Mon2016
Hello Holch,

Sorry, I don't think I understood myself. hahaha


Well, in short, I want to show the selected stores from Q13a in Q21 that are asked brand by brand, so setting the same question 47 times for 47 brands makes a very long survey.

So I want to look at the possibility of only having 10 questions and pulling the ones that you checked in Q13a.

<3

Please Log in to join the conversation.

More
2 years 2 months ago - 2 years 2 months ago #244501 by holch
Looking at your survey, it made a little bit more sense.

However, what happens when someone marks more than 10 in Q13a? Maybe change the question to something like,
"Por favor, escoge hasta 10 tiendas donde mas has comprado ropa/zapatos en los últimos 6 meses?" or something like that.

Now you will need to pipe these up to 10 brands into the 10 follow up questions, which is a little tricky. I will have to think. Probably Joffm has a good solution, I am sure. 

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.
Last edit: 2 years 2 months ago by holch.

Please Log in to join the conversation.

More
2 years 2 months ago #244503 by Mon2016
Yes of course.

My idea is believing that it is less likely that they have bought in more than 10 stores.

But having the idea of ​​how to do it, I can play a little with the number of questions that I can enter to allow me to activate the survey.

Hopefully @Joffm can rescue me from this problem.
 
 

Please Log in to join the conversation.

More
2 years 2 months ago #244505 by Joffm

Probably Joffm has a good solution, I am sure. 

Haha,

What you can do, is:
In an equation "eqBrands" join the selected brands into a string, like
{join(if(Q13a_1=="Y","A",""),if(Q13a_2=="Y","B",""),...,if(Q13a_26=="Y","Z",""),if(Q13a_27=="Y","a",""),...,if(Q13a_47=="Y","u",""))}
You will get something like "DGMTfm"
Now in each of your ten questions you display the brand of the respective character:
Q2101: {if(substr(eqBrands,0,1)=="A","Adidas",if(substr(eqBrands,0,1)=="B","Amazon",if(substr(eqBrands,0,1)=="C","Bershka",...,if(substr(eqBrands,0,1)=="u",Q13_other))))...)))}

Q2102: {if(substr(eqBrands,1,1)=="A","Adidas",if(substr(eqBrands,1,1)=="B","Amazon",if(substr(eqBrands,1,1)=="C","Bershka",...,if(substr(eqBrands,1,1)=="u",Q13_other))))...)))}
...

Disadvantage: Before you are able to analyze, you will have to restructure your data.

Joffm

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

Please Log in to join the conversation.

More
2 years 2 months ago #244507 by Mon2016
Thank you very much Joffm

From what I understand:

Getting the result of eqBrands

This goes in the text of my question: {if( substr(eqBrands,0,1)=="A","Adidas",if(substr(eqBrands,0,1)=="B","Amazon", if(substr(eqBrands,0,1)== "C","Bershka",...,if(substr(eqBrands,0,1)=="u",Q13_other))))...

I substitute when it is the case:

Q2101: ( substr(eqBrands,0,1)

Q2102: ( substr(eqBrands,1,1)

Q2103: ( substr(eqBrands,2,1)

Q2104: ( substr(eqBrands,3,1)

Q2105: ( substr(eqBrands,4,1)

....

But which relevant equation should I use if they only chose 3 brands?

It should only show 3 and not all 10.

Sorry but sometimes I'm a little slow to understand.


:(

Please Log in to join the conversation.

More
2 years 2 months ago #244510 by Joffm
Either you check if the substring is empty, 
or you check the length of the string.
Joffm 

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

Please Log in to join the conversation.

More
2 years 2 months ago #244514 by Mon2016
Thanks Joffm,
Would this be from the eq Brands question?

It would be like count(eqBrands)==1

count(eqBrands)==2

count(eqBrands)==3
Could this work?

Thank you for all of your help <3

Please Log in to join the conversation.

More
2 years 2 months ago #244516 by Joffm
Yes, "count" works, too.
But, of course not count(eqBrands).
"eqBrands" is a string.
But you know that it contains one character for each selected brand.
Read the manual about "implemented functions".

Joffm 

 

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

Please Log in to join the conversation.

More
2 years 2 months ago #244517 by Mon2016
Excellent Joffm

you helped me a lot

Millions of thanks... 

Please Log in to join the conversation.

More
2 years 2 months ago #244787 by Mon2016
Hello Joffm,

I'm sorry to write again on the subject, I was doing what you recommended me to do for the Q21 questions, (I hope you remember since several days have passed) everything goes perfectly but now I am going through something complicated for me.

I put in context:

I have a multiple choice question (Q13a) where I show a large list of brands where they were able to buy

Of the selected brands, I am only taking the first 5 to apply my next questions, which are Q21 and Q21a.

In these two questions, the 5 brands that they selected in Q13a are evaluated, but Q21 only applies to physical brands and Q21a only to online brands.

The codes that only apply to online, that is, they should not be shown in Q21 and if in Q21a they are these:

2
13
16
19
37
45

I have tried many ways to do this jump but can't do it. Anyone faced with this kind of problem?

I am attaching a test survey to make it easier to identify my problem


Thank you Joffm for your patience.

Greetings

Moon

Please Log in to join the conversation.

More
2 years 2 months ago #244798 by Joffm

Of the selected brands, I am only taking the first 5 to apply my next questions, which are Q21 and Q21a.

LimeSurvey does not store the order. So how do you decide which are the "first 5"?
At random?
Then there is a really short solution. If you have something else inmind, please, explain!

Do not "join" the brands in "eqBrands", but use the function "list" and assign the brands separated (physical - online) to a next question of type "multiple short text" (one subquestion for physical one for online. This question you hide with the css class "hidden"
I called it "strBrands" with subquestion codes "p" (physical" and "o" (online).
Now in "eqBrands" you assign with two equations.
{strBrands_p=list(if(Q13a_1=="Y","A",""), if(Q13a_3=="Y","C",""), if(Q13a_4=="Y","D",""),..., if(Q13a_43=="Y","q",""), if(Q13a_44=="Y","r",""), if(Q13a_46=="Y","t",""), if(Q13a_47=="Y","u",""))}

{strBrands_o=list(if(Q13a_2=="Y","B",""), if(Q13a_13=="Y","M",""), if(Q13a_16=="Y","P",""), if(Q13a_19=="Y","S",""), if(Q13a_37=="Y","k",""), if(Q13a_45=="Y","s",""))}

In this question you insert this script, which randomizes the brands and then displays only the first 5 into each subquestion.
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(){
      var strp=$('#question{QID} input[type="text"]:eq(0)').val().replace(/\s+/g, '');
      var stro=$('#question{QID} input[type="text"]:eq(1)').val().replace(/\s+/g, '');
 
// Fill the arrays
      var arrp = strp.split(',');
      var arro = stro.split(',');
// Shuffle and truncate
      arrp = shuffle(arrp);
      arrp = arrp.slice(0,5).join('');
      arro = shuffle(arro);
      arro = arro.slice(0,5).join('');
// Fill the subquestion with the results
      $('#question{QID} input[type="text"]:eq(0)').val(arrp);
      $('#question{QID} input[type="text"]:eq(1)').val(arro);
      $('#ls-button-submit').trigger('click');
   });
</script>

Then you use the same equation to pipe the brands into your questions; instead of "eqBrands" you use "strBrands_p" and "strBrands_o".
Quickly changed with the "search and replace" button.

And you may use a question relevance using the string length, like
Q2101: strlen(strBrands_p)>0
Q2102: strlen(strBrands_p)>1
...

That's all.


By the way:
What is this?
count(Q13a_1.NAOK,Q13a_3.NAOK,Q13a_4.NAOK,Q13a_5.NAOK,Q13a_6.NAOK,Q13a_7.NAOK,Q13a_8.NAOK,Q13a_9.NAOK,Q13a_10.NAOK,Q13a_11.NAOK,Q13a_12.NAOK,Q13a_14.NAOK,Q13a_15.NAOK,Q13a_17.NAOK,Q13a_18.NAOK,Q13a_20.NAOK,Q13a_21.NAOK,Q13a_22.NAOK,Q13a_23.NAOK,Q13a_24.NAOK,Q13a_25.NAOK,Q13a_26.NAOK,Q13a_28.NAOK,Q13a_29.NAOK,Q13a_30.NAOK,Q13a_31.NAOK,Q13a_32.NAOK,Q13a_33.NAOK,Q13a_34.NAOK,Q13a_35.NAOK,Q13a_36.NAOK,Q13a_38.NAOK,Q13a_39.NAOK,Q13a_40.NAOK,Q13a_41.NAOK,Q13a_42.NAOK,Q13a_43.NAOK,Q13a_44.NAOK,Q13a_46.NAOK,Q13a_47.NAOK)==1 or count(Q13a_1.NAOK,Q13a_3.NAOK,Q13a_4.NAOK,Q13a_5.NAOK,Q13a_6.NAOK,Q13a_7.NAOK,Q13a_8.NAOK,Q13a_9.NAOK,Q13a_10.NAOK,Q13a_11.NAOK,Q13a_12.NAOK,Q13a_14.NAOK,Q13a_15.NAOK,Q13a_17.NAOK,Q13a_18.NAOK,Q13a_20.NAOK,Q13a_21.NAOK,Q13a_22.NAOK,Q13a_23.NAOK,Q13a_24.NAOK,Q13a_25.NAOK,Q13a_26.NAOK,Q13a_28.NAOK,Q13a_29.NAOK,Q13a_30.NAOK,Q13a_31.NAOK,Q13a_32.NAOK,Q13a_33.NAOK,Q13a_34.NAOK,Q13a_35.NAOK,Q13a_36.NAOK,Q13a_38.NAOK,Q13a_39.NAOK,Q13a_40.NAOK,Q13a_41.NAOK,Q13a_42.NAOK,Q13a_43.NAOK,Q13a_44.NAOK,Q13a_46.NAOK,Q13a_47.NAOK)==2 or
... more and more ...
count(Q13a_1.NAOK,Q13a_3.NAOK,Q13a_4.NAOK,Q13a_5.NAOK,Q13a_6.NAOK,Q13a_7.NAOK,Q13a_8.NAOK,Q13a_9.NAOK,Q13a_10.NAOK,Q13a_11.NAOK,Q13a_12.NAOK,Q13a_14.NAOK,Q13a_15.NAOK,Q13a_17.NAOK,Q13a_18.NAOK,Q13a_20.NAOK,Q13a_21.NAOK,Q13a_22.NAOK,Q13a_23.NAOK,Q13a_24.NAOK,Q13a_25.NAOK,Q13a_26.NAOK,Q13a_28.NAOK,Q13a_29.NAOK,Q13a_30.NAOK,Q13a_31.NAOK,Q13a_32.NAOK,Q13a_33.NAOK,Q13a_34.NAOK,Q13a_35.NAOK,Q13a_36.NAOK,Q13a_38.NAOK,Q13a_39.NAOK,Q13a_40.NAOK,Q13a_41.NAOK,Q13a_42.NAOK,Q13a_43.NAOK,Q13a_44.NAOK,Q13a_46.NAOK,Q13a_47.NAOK)==15



Doesn't it only mean: count>0?
And if you had read the manual about the variables "self" and "that", it is shortened to
count(that.Q13a.NAOK)>0

Joffm

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

Please Log in to join the conversation.

More
2 years 2 months ago #244799 by Mon2016
Hello Joffm

Thank you very much for your help, now you opened up a bigger picture than what I was looking for.

I tell you that I did what you indicated and everything seems to be correct, there is only something that I do not know if I have not done well, since in "strBrands_p" and "strBrands_o" it registers commas to separate each brand, so when using the relevant equation "strlen(strBrands_p)>0" I guess it's taking those commas and doesn't display Q21 questions well.

Can you help me figure out what I did wrong?

I am attaching my lss survey to see if you could guide me where I went wrong.


Thanks again for all your help.

​​​​​​​Moon

Please Log in to join the conversation.

More
2 years 2 months ago #244800 by Joffm
Hi,

it registers commas to separate each brand

Exactly, this is what the "list" function does.
And it is necessary.
In the script you see this line
var arrp = strp.split(',');
Meaning: the comma separated text is inserted in an array and the comma is used as separator.

But: Where is the script in question "strBrands"

On the other hand you inserted ALL brands into strBrand_o. I thought only brands 2,13,16,19, 37,45 are online brands.


Joffm

 

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

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose