I am trying to pull survey responses from one question into a ranking question and it's unclear what needs to be written into the expression manager and conditions settings for this to work. I've tried looking at the manual and searched this forum, but I'm a novice coder and having issues finding the information I need to do this. Here is the example:
Question 1 (type: multiple choice): Which groups are you interested in joining? Select all that apply.
Choices for Question 1: Group 1, Group 2, Group 3, Group 4, Group 5
Condition for Question 2: If the respondent selects more than one group (Groups 2-4 for the example), they will then be shown a ranking question asking them to rank from the responses they selected.
Question 2 (type: ranking): Please rank the groups you selected based on your interest in joining.
Choices for Question 2: Group 2, Group 3, Group 4
The trick is to refer to the MC (multiple choice) question with an array filter that refers to exactly the same subquestion codes as there are in the ranking questions.
Furthermore you make the raking question appear only when the number of answers in the MC question is more than 1. That is done using an expression script and placed in the relevance formula of the ranking question.
The mccount question (actually an equation) is to show how to count the number of answered subquestions.
Greetings from The Netherlands,
Tammo
Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
Thank you, Tammo. Everything is now working except that the options are not displaying in the ranking question. The ranking question displays when I select more than one option but the options are not listed to rank.
I plan to spend more time trying to figure this out tomorrow, but I've attached the .lss file for what I've been able to do up to this point if you're interested. My multiple choice question code is: WhichTWG. The question code for the equation is: Equation. The ranking question is: TWGRank.
So, altering your code, the Equation is written as: {count(that.WhichTWG)}
For the TWGRank question, I added the following:
Relevance equation: count(that.WhichTWG) > 1
Array Filter in logic options: WhichTWG
I am not overly suprised with the result. There is only ONE answer option in TWGRank and its answer code is "A1". There is no subquestion code "A1" corresponding in the question "WhichTWG", you have called them all "SQxxx".
For the array filter to work, the answer codes in the question that needs filtering (TWGrank) must have exactly the same codes as the respective subquestion in WhichTWG.
E.g. "Airborne Remote Sensing Data Quality TWG" must have the same code in both questions, otherwise LS can't possible know which answer options to filter. This is all described in the manual about the array filter.
I would recommend to change both the answer codes and subquestion codes to numbers only and use the same numbers for the items. And of course you need to include the same itens as answer options to TWGRank as you have in WhichTWG. Otherwise it is just natural, that the array filter can not work. There is nothing to filter in your example.
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.
Tammo, your example was correct. I just missed that you had also included the list from "mc1" in the ranking question, "r1." I was going to take a deeper dive into the manual today, so thanks Holch for letting me know what I was missing and where to look. I have not used the array filter before, so I will read more about it and its applications. Many thanks to both of you for all the help.