Welcome to the LimeSurvey Community Forum

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

Pulling responses from previous survey question into ranking question

  • acrall
  • acrall's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 8 months ago #203249 by acrall
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 topic has been locked.
  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
3 years 8 months ago - 3 years 8 months ago #203251 by tammo
Hi, please see the attached example.

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
Last edit: 3 years 8 months ago by tammo.
The following user(s) said Thank You: acrall
The topic has been locked.
  • acrall
  • acrall's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 8 months ago #203264 by acrall
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
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 8 months ago - 3 years 8 months ago #203266 by holch
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.

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

Last edit: 3 years 8 months ago by holch.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 8 months ago #203267 by holch
I changed your subquestion codes in WhichTWG to numeric codes, saved it as labelset and then imported the labelset into TWGrank.

Now the items in WhichTWG and TWG are the same in terms of subquestion/answer code and the array filter works like a charme.

Attached your corrected LSS file (also deleted the empty group at the end which caused an error when previewing the survey).

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

The topic has been locked.
  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
3 years 8 months ago #203275 by tammo
This was how it was in my example, wasn't it?

Tammo


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 8 months ago #203298 by holch

This was how it was in my example, wasn't it?


I assumed so, but I did not check your file, I just looked at the file acrall send.

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

The topic has been locked.
  • acrall
  • acrall's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 8 months ago #203299 by acrall
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.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose