Show 10 out of 100 subquestions from a multiple numerical input question

Plus d'informations
il y a 3 semaines 4 jours #187879 par AliceR
Hello everyone!

I'm completely stuck and I was hoping someone on this forum might help me.

Before I start, I would like to warn that I am a complete beginner at limesurvey, and finding an answer in the form of a conditional eqation would be amazing, but of course it might not be possible.

I am using the free version of Limesurvey at the moment, since my team has to get authorization before it can buy the premium version. The idea is also basically to see if Limesurvey can do this before buying it.

I'm doing a survey using the multiple numerical input question and I would like 10 questions picked randomly out of 100 to be shown to the user (10 and 100 are used as an example here).

Just so you have the complete picture, right before this question, the user is seleting one answer in a dropdown question, and their answer influences which group of 100 questions the 10 quesctions are going to be picked out of.

I've tried using answers to similar topics such as

www.limesurvey.org/forum/french-forum/10...cifique-de-questions

which is in French so it might not help you much, but basically it said to do this (to select 2 out of 4 questions):

count(Q1.NAOK, Q2.NAOK, Q3.NAOK) LT 2

in every question conditional equation field, changing the Q1, Q2, Q3 so that the question I am on doesn't appear in the list (so in the example above, out of Q1, Q2, Q3, Q4, the equation would be for Q4).


I have tried adapting it this way:

I created 3 questions in the same group, each with 5 subquestions, and I wrote this in the conditional equation field, changing the Q1, Q2, Q3 when needed:

Count(Q2_SQ001.NAOK, Q2_SQ002.NAOK, Q2_SQ003.NAOK, Q2_SQ004.NAOK,Q2_SQ005.NAOK, Q1_SQ001.NAOK, Q1_SQ002.NAOK, Q1_SQ003.NAOK, Q1_SQ004.NAOK, Q1_SQ005.NAOK) LT 5



But it only shows the same group (the last one I believe) and doesn't randomise the questions.

I have also tried basically the same thing with .relevanceStatus ( manual.limesurvey.org/Expression_Manager..._of_the_questions.29 ) while also adding all my questions to the same randomisation group, but it doesn't seem to work either.

I would be forever grateful if someone could help me. If there is a link with this explanation and I have just not found it, I apologise! Do not hesitate to tell me if I missed some essential information.

Thank you so much once again and have a good day :)

Alice

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 4 jours #187889 par jelo
You will find workarounds for questions to randomly choose questions from a bucket.
But you are looking for subquestions, not questions.
There were some threads about that.
You might check this here with the newest LimeSurvey version.
www.limesurvey.org/forum/can-i-do-this-w...-of-matrix-questions

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 4 jours #187891 par tpartner
I'm not sure this can be done with Expression Manager alone.

It gets a little complicated as you have a requirement that a dropdown question defines sub-sets of the array sub-questions.

A solution requiring significant JavaScript might be to...

- Before the array question, insert a hidden (via CSS class) multiple-choice question with exactly the same sub-question as the array.

- Apply an array filter on the array question, based on the hidden question.

- Have JavaScript:
--- detect the dropdown answer
--- randomize the relevant sub-question codes
--- check the first 10 if those codes in the hidden question

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 4 jours - il y a 3 semaines 4 jours #187892 par AliceR
Thank you very much for your reply!

Unfortunately I've tried it out and it only shows the first 3 subquestions no matter how many times I try, and doesn't randomize. If i change the order of the subquestions in my list, the subquestions shown change accordingly.

It is similar to the problem I've encountered when trying the previous solutions I've explained in my first post.

But thank you anyway for your help :)
Dernière édition: il y a 3 semaines 4 jours par AliceR.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 4 jours #187893 par AliceR
Thank you so much for taking the time to explain this to me. Unfortunately, I am not able to code in Javascript and CSS (and wouldn't even know how to access the place where I can code) and do not have the time to learn it before my internship ends. This is why I was hoping it could be resolved "easily".

But thank you very much anyway!

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 4 jours #187894 par AliceR
Just another quick follow up question: if I did not have that dropdown question, would it be possible to resolve it using the Expression Manager alone?

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 4 jours - il y a 3 semaines 4 jours #187899 par Joffm
Well,
don't be afraid of a little snippet of javascript.

Here is my solution.
First question: short text.
In the question text enter this small javascript
<script type="text/javascript" charset="utf-8">
	$(document).on('ready pjax:scriptcomplete',function(){
        const numbers = [ ...Array(100).keys() ].map(num => num + 1);
        numbers.sort(() => Math.random() - 0.5);
        $('#question{QID} input[type="text"]').val(","+numbers.slice(0, 10)+",");
 //       $('#question{QID}').hide();
   });
</script>
In your real survey you hide this question by removing the "//" in the last line-

Array(100).keys -> because you were talking about 100 questions. You have to adapt.
val(","+numbers.slice(0, 10)+","); -> 0,10 you want to have 10 selected numbers.
The added comma ","+numbers.slice(0, 10)+"," is used in the second question.

This will look like this:

This second question is your multiple numeric input.
You have 100 subquestions, but show only 10.
So each subquestion will get a relevance equation, that just checks if the text contains it.

Relevance equation of
SQ001: strpos(Q0,",1,")>0
SQ002: strpos(Q0,",2,")>0
...
SQ050: strpos(Q0,",50,")>0
..
SQ073: strpos(Q0,",73,")>0
...

Now you see the reason for the two added commas. To avoid conflict of "1", "10", "51",...

And your question is:


Example only 5 out of 20.


And this sample survey shows it for 10 out of 50.

Fichier attaché :

Nom du fichier : limesurvey...5771.lss
Taille du ficher :44 ko


Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Pièces jointes :
Dernière édition: il y a 3 semaines 4 jours par Joffm.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 3 jours - il y a 3 semaines 3 jours #187926 par Joffm
Here the same example, but in my opinion with a better understandable javascript script.
(At least for javascript dummies like me)

And also, because I do not trust the randomization in the previous example.
A small test showed a very strange distribution.

Again: It is only for 10 out of 50. So you have to adapt. Just change the "51" to "101".

Joffm

Fichier attaché :

Nom du fichier : limesurvey...8-22.lss
Taille du ficher :46 ko


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Pièces jointes :
Dernière édition: il y a 3 semaines 3 jours par Joffm.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 3 jours #187927 par AliceR
Oh my god! First of all, I want to thank you SO MUCH not only for taking the time to do this me, but also for taking the time to explain it to me. You are amazing. Danke schön!

I've downloaded both of your files and tested both and saw it worked perfectly. But for some reason, when I try to replicate it, it doesn't. I've waited to reply to see if I could make it work, but I couldn't...

I tried to do it with 5 out of 10 subquestions and modified the code of the first question. The first part (showing 5 random numbers) works perfectly, but then all my 10 subquestions are shown. Do you have any idea why this could happen?

Don't worry if you don't have time to answer, I'll figure it out eventually.

Just a quick follow up question: if I now need to combine this with my drpdown question and the fact that the numeric question changes depending on the andwer to this dropdown question, do I add the conditon on G1 or G0 (or both)?

Once again, thank you so much, you're amazing.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 3 jours #187935 par AliceR
I've figured out my mistake and it works perfectly! Thank you SOOOOO much!!

I'll try to combine it owith my dropdown question now.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 3 jours - il y a 3 semaines 3 jours #187937 par Joffm
Well,
the drop-down.
If there are also 10 out of 100, but only other question texts, just use the same definition and have the multiple numeric question several times with different subquestions but the same logic.
Display the selected one be relevance equation.

In this case put the dropdown into G0 instead of the text display question and the Q1, Q2, Q3,... into G1.
Display per relevance equation.

BTW; The reason for one visible question is G0 is:
You hide the "Definition" by a javascript statement. LimeSurvey thinks "Oh, there is a wuestion. I have to show the group". But then the question is hidden and tyou see an empty group with a "next" button.

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Dernière édition: il y a 3 semaines 3 jours par Joffm.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 3 semaines 3 jours #187947 par AliceR
I'll definitively do that. Thank you once again for all your help, you're a godsend.
I hope you have a wonderful end of the week!

Connexion ou Créer un compte pour participer à la conversation.

Commencez dès maintenant !

Créez simplement un compte et commencez à utiliser LimeSurvey dès aujourd'hui.

Inscrivez-vous maintenant

Inscrivez-vous à notre Newsletter!