Select 10 questions with highst values from 20 array questions

Mehr
1 Monat 1 Woche her #192696 von TripleL1701
Hello,

my problem is the following:
I have created a question group that contains 20 questions. Each question is a one line array question asking the participant how often he uses a certain product: Never, almost never, occasionally, often, very often.
From these 20 products I then want to select the 10 products that are used most frequently by the participant. For example if the participant says that he uses nine of the products often and 11 occasionally, then I want to include the 9 products he uses often plus one random product from the 11 occasional ones, for my next question group. In this next group I then want to ask the same two questions for all of these products.

I would be very thankful if anyone knows how to do this or has any tips for me.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

LimeSurvey Partners
Mehr
1 Monat 1 Woche her #192701 von Joffm
Do you want to force 10 products, even if 12 products are never or almost never used?


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

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 1 Woche her #192734 von TripleL1701
Yes, I want to force 10 products. In the case that 12 are never or almost never used, I want to the survey to select two products at random or just the first two in the list.

Thanks in advance!

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 1 Woche her #192744 von Joffm
Hi,
my idea is:
join the answer codes to get a string like "40234333221233212243"
{join(that.Q1)}
Here meaning "0 = never", "4 = "always"

Now I do an ajax call and the php program sends back the ten most often used products.

You see that codes 3 & 4 cover 8 products.
So we need two more of code 2 (out of answers 5,6,15,16)




As you see, answer 5 and 16 was chosen.
Now all selected products are checked in the multiple question. This you may use as array filter or whatever you want to do.
By the way: To check the subquestion, just use an equation with:
{M1_SQ001=if(strpos(res,"001")>0,"Y","")}
{M1_SQ002=if(strpos(res,"002")>0,"Y","")}
{M1_SQ003=if(strpos(res,"003")>0,"Y","")}
...

The ajax call:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
 
  $.post('https://www.myServer.com/myFolder/getRandItems.php' , { list: "{join}"}, function(data) {
 
                   $('#question{QID} input[type="text"]').val(data)
 
			});
//  $('#question{QID}').hide();
	});
</script>

And the php "getRandItems.php" could be something like this (here a very quick and rough one):
<?php
function shuffle_assoc($list) {
  if (!is_array($list)) return $list;
 
  $keys = array_keys($list);
  shuffle($keys);
  $random = array();
  foreach ($keys as $key)
    $random[$key] = $list[$key];
 
  return $random;
}
 
$list=$_POST['list'];
 
$aList=array();
for ($l=4;$l>=0;$l--) {
  $j=1;
  for ($i=1;$i<21;$i++) {
    if(substr($list,$i-1,1)==$l) {
      $aList[$l][$j]=$i;
      $j++;
    }
  }
  $aList[$l]=shuffle_assoc($aList[$l]);
}
 
 
$newList='#';
$j=4;
do {
  foreach ($aList[$j] as $number) {
    $newList.=str_pad($number,3,"0",STR_PAD_LEFT);
    $newList.="#";
  }
  $j--;
} while (strlen($newList) < 41);
 
$newList=substr($newList,0,41);
 
echo $newList;
 
?>

Joffm

I am sure that there will be a solution in plain javascript, but my knowledge of that is really limited.


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 4 Tage her #192832 von TripleL1701
Dear Joffm,

thank you very much for your detailed response!!
Since I am very unexperienced with code and surveymonkey, i sadly have no idea where and how to insert the code you proposed.
I have been editing my survey only with the predefined button options so far.

Can you help me?

Thank you and best,
Luka

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 3 Tage her #192834 von Joffm
Hi, Luka,

Since I am very unexperienced with code and surveymonkey

Probably you are in the wrong forum. This one is LimeSurvey related. ;) ;) ;)

So you should read this (at least):
https://manual.limesurvey.org/Workarounds:_Manipulating_a_survey_at_runtime_using_Javascript#How_to_use_Script_.28eg._JavaScript_etc..29_in_LimeSurvey
Here you enter the javascript snippet.

And the *.php file?
You need a very little bit of experience with this programming language.
You just upload this script to a folder of the server where LimeSurvey is hosted.

I didn't ask - and you didn't mention it: where is your LimeSurvey installation hosted?
Do you have access to this server?
If not, forget everything I wrote and think about a different solution.

And I still prefer the solution that you use the products of the two categories ("often" and "very often") without limitation (or with limitation to max. 10; this can be done without any javascript)

Imagine: There is only one product used "often", all others "never", "nearly never".
Are you going to do a weighting of the answers later in your analysis?
Or how do you compare the ratings of the "not used" and "often used" products?

Joffm

Joffm


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

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 1 Tag her #192959 von TripleL1701
Dear Joffm,

I now decided to follow your advice.
My survey is now set up the following way:
Every product has a seperate question group.
In this question group, I will first ask how often the product is used and if the user selects "often" or "very often" he will get three more questions regarding the product.
This will be done for all 20 Products and the products will appear in random order.

My question to you is:
Is it possible to end the survey as soon as the participant has filled out 10 products with "often" or "very often?
I want to do this, to avaoid that the partiipant gets annoyed after too many questions and ends the survey leaving me with no answers at all.

If you know a way to do this without javascript this would be great :)

Thank you and best,

Luka

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 1 Tag her - 1 Monat 1 Tag her #192975 von Joffm

Is it possible to end the survey as soon as the participant has filled out 10 products with "often" or "very often?


This you should do by group relevance.
Count the numbers of "often" and "very often" and display the next groups only, if this count is <11.

There is an implemented function "countifop".

And please attach a lss export of your survey.

To have understood correctly.
You do not ask all 20 products at the beginning and then start asking the detail questions, up to 10, but the frequency question is in the group?

You may loose answers. IMO this will not affect the length of the survey.

Joffm


Addition:

You can do it by inserting a group relevance like:
1st group: sum(countifop(">",3,Q2.NAOK),countifop(">",3,Q3.NAOK),countifop(">",3,Q4.NAOK),countifop(">",3,Q5.NAOK),countifop(">",3,Q6.NAOK),...) lt 10
2nd group: sum(countifop(">",3,Q1.NAOK),countifop(">",3,Q3.NAOK),countifop(">",3,Q4.NAOK),countifop(">",3,Q5.NAOK),countifop(">",3,Q6.NAOK),...) lt 10

with Q1,Q2,... frequency questions of the products
frequency codes numeric - 1=never, 5=very often

You see: In each equation the question of thast specific group is missing.

As I said: Send your prototype as lss export.


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Letzte Änderung: 1 Monat 1 Tag her von Joffm.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 1 Tag her #192992 von TripleL1701
Dear Joffm,

your help is highly appreciated!
I think I sort of understand the logic but I am still not sure how to implement it in my specific case.
Maybe you are able to help me by haing a look at the lss export file that i have attached to this message?
It would mean a lot to me.

Thank you in advance!
Best,
Luka

Dateianhang:

Dateiname: limesurvey...1492.lss
Dateigröße:244 KB
Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 1 Tag her - 1 Monat 1 Tag her #193005 von Joffm
Hi,

At first I "complain about" this:
You still have these default "A1", "A2",... Codes in your frequency question.
Now there are two disadvantages:
1. This scale has at least an ordinal level. In your analysis you surely want to calculate some statistical tests to see if there are significant differences. Here you need numerical codes.
You know the mean of "A1", and "A4" is not "A2,5".
2. You want to count the products which are used "often" and "very often".
With numerical codes these are the products with a code >4, e.g. "Produkt1>4".
And in the function "countifop" just countifop(">",4,Produkt1.NAOK)
With your codes which are alphanumerical you have to do it like this:
Produkt1=="A5" OR Produkt1=="A6", as you see in your conditopns for the following questions.
Fortunately string comparison will work, because "A4" is less than "A5", but beware: "A10" is less than "A4".

And you used "Condition builder" instead of "Expression Manger".
In my opinion the condition builder is outdated. Expression Manager is much more flexible.
And you get in trouble if you want to change the structure.

Furthermore there is an error in "Produkt11", The code was changed to "r158q0"
<row>
<qid><![CDATA[616]]></qid>
<parent_qid><![CDATA[0]]></parent_qid>
<sid><![CDATA[831492]]></sid>
<gid><![CDATA[63]]></gid>
<type><![CDATA[F]]></type>
<title><![CDATA[r158q0]]></title>


Well, enter this in the relevance equation of each group (you see there is the change code; maybe it happened during export)
Group "Produkt 1":
sum(countifop(">","A4",Produkt2_SQ001.NAOK),countifop(">","A4",Produkt3_SQ001.NAOK),countifop(">","A4",Produkt4_SQ001.NAOK),countifop(">","A4",Produkt5_SQ001.NAOK),countifop(">","A4",Produkt6_SQ001.NAOK),countifop(">","A4",Produkt7_SQ001.NAOK),countifop(">","A4",Produkt8_SQ001.NAOK),countifop(">","A4",Produkt9_SQ001.NAOK),countifop(">","A4",Produkt10_SQ001.NAOK),countifop(">","A4",r158q0_SQ001.NAOK),countifop(">","A4",Produkt12_SQ001.NAOK),countifop(">","A4",Produkt13_SQ001.NAOK),countifop(">","A4",Produkt14_SQ001.NAOK),countifop(">","A4",Produkt15_SQ001.NAOK),countifop(">","A4",Produkt16_SQ001.NAOK),countifop(">","A4",Produkt17_SQ001.NAOK),countifop(">","A4",Produkt18_SQ001.NAOK),countifop(">","A4",Produkt19_SQ001.NAOK),countifop(">","A4",Produkt20_SQ001.NAOK)) lt 10

Group "Produkt 2":
sum(countifop(">","A4",Produkt1_SQ001.NAOK),countifop(">","A4",Produkt3_SQ001.NAOK),countifop(">","A4",Produkt4_SQ001.NAOK),countifop(">","A4",Produkt5_SQ001.NAOK),countifop(">","A4",Produkt6_SQ001.NAOK),countifop(">","A4",Produkt7_SQ001.NAOK),countifop(">","A4",Produkt8_SQ001.NAOK),countifop(">","A4",Produkt9_SQ001.NAOK),countifop(">","A4",Produkt10_SQ001.NAOK),countifop(">","A4",r158q0_SQ001.NAOK),countifop(">","A4",Produkt12_SQ001.NAOK),countifop(">","A4",Produkt13_SQ001.NAOK),countifop(">","A4",Produkt14_SQ001.NAOK),countifop(">","A4",Produkt15_SQ001.NAOK),countifop(">","A4",Produkt16_SQ001.NAOK),countifop(">","A4",Produkt17_SQ001.NAOK),countifop(">","A4",Produkt18_SQ001.NAOK),countifop(">","A4",Produkt19_SQ001.NAOK),countifop(">","A4",Produkt20_SQ001.NAOK)) lt 10

You see, there are all Produkte, except the Produkt of that group.

By the way:
Could be shorter by NOT using a question of type array and using shorter question codes (P1,P2,...) and numerical codes.

Next idea: Use a question of type array(number) or multiple numerical input for the price question (and validate).
Will look better.

Joffm

Maybe later I'll send a limited example (less than 20 products)


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Letzte Änderung: 1 Monat 1 Tag her von Joffm.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 1 Tag her #193014 von Joffm
Hi,
not the best idea to count "how many times was a product used often resp. very often".
Better to count how many times the "Zufriedenheit" was displayed.
Much easier, you use QCode.relevanceStatus.

Example will follow soon.

Joffm


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

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
1 Monat 19 Stunden her #193030 von Joffm
Hi,
here the example (4 out of 8)

Dateianhang:

Dateiname: limesurvey...8398.lss
Dateigröße:97 KB


I came back to the "countifop" function.
I was a bit struggling with the "relevanceStatus" and didn't want to waste your time.

Don't forget to validate the prices. 'teuer' > 'fair'.

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha