How do I pipe text based on ranking from a Drag and Drop question?

SwimmySwimmy CanadaCommunity Member Qubie ✭
edited December 2020 in Custom Code

How do I pipe text based on ranking from a Drag and Drop question?

Hello,

Here is my survey:

Q1 is a "Drag and Drop" question where respondents are asked to select five options from a list of 20 and put them in the box. As respondents put their selections in the box, they are ranked automatically.

Q2 I would like to ask respondents to justify their selection of the top TWO choices from Q1. I have set up a form, text entry question and am trying to pipe the choices from Q1 into the form labels. There only seems to be the option to either pipe ALL the selected choices from Q1, or select specific options, but not based on the rank. Does anyone know how I can isolate Q1/SelectedChoice/Rank1 and Q1/SelectedChoice/Rank2?

Thank you!!

Answers

  • lizb311lizb311 Community Member, XMPN Member Guru ✭✭

    If you wanted just one item, then you could use ${q://QID6/ChoiceGroup/ChoiceWithLowestValue} to get the item that was ranked as #1. But I don't think you can get the top 2 items with piped text.

    Instead, you could use the "Carry Forward Form Fields" feature. Click on settings to edit your text entry form question, and then click "Carry Forward Form Fields." If you set the logic to carry forward the items less than 3 from your rank question, then it will display only the items ranked #1 and #2 in your rank question. Will that work for you?


  • Leon24Leon24 OntarioCommunity Member Qubie ✭

    My problem is actually reverse of this. From a multi-choice question to rank order piping

    Q1 is a MCQ (Last option is "Any Other" ___________)

    Q2 is rank order

    If they choose more than 2 responses in Q1 then show them Q2 to rank them. I want to pipe just the text in Q2 from the "Any Other" option in Q1

  • lizb311lizb311 Community Member, XMPN Member Guru ✭✭

    @Leon24 So if your Q1 is a (multi-select) multiple choice question, and your Q2 is a rank order...

    You could use "carry forward" still. I believe specifying "Selected Choices - Entered Text" instead of just "Selected Choices" should ensure that the text the respondent typed into the text entry box in Q1 is displayed in Q2.

    -----

    Alternatively, you could use piped text and display logic for each item in Q2.

    Your piped text would look something like this for each item except the text entry: ${q://QID13/ChoiceDescription/1} (note that QID13 is the internal id numbering for my question - it'll probably be different for yours).

    And the piped text for the text entry field would look something like this (again, the QID13 part will probably be different for you): ${q://QID13/ChoiceTextEntryValue/4}

    Here's a screenshot of what the piped text would look like in the question. Each individual item should have display logic (beyond the overall display logic that shows/hides Q2).


    Your display logic would look like this for every item except the text entry:


    The display logic for the text entry choice would look like this (specifying "is not empty" rather than "is selected" would make sure that response choice only displays if the respondent actually typed something into the text entry box):


    -----

    And to be thorough... as you said in your original comment, Q2 should only display if somebody selected more than 1 response in Q1.... so where the selected count is greater than or equal to 2, as shown in the screenshot below.


    Hope that does what you want!

  • Leon24Leon24 OntarioCommunity Member Qubie ✭

    @lizb311 Thank you very much. This definitely works.

  • Leon24Leon24 OntarioCommunity Member Qubie ✭

    @lizb311 Fundamentally the solution is working. However, when I am using rank order question you can see that I am not getting an option to code the responses individually like ${q://QID13/ChoiceTextEntryValue/4}, they are coming in as piped. Also, I cannot use the display logic for the text entry choice.


  • lizb311lizb311 Community Member, XMPN Member Guru ✭✭

    @Leon24 Yeah, the carry forward doesn't work with display logic for individual response choice items. But you shouldn't need it. The piped text & display logic option I gave you was just a different way of doing the same thing that the carry forward does. You don't need to do both. I would keep the carry forward as you have it set up now. Is it working properly in the Survey Preview?

  • Leon24Leon24 OntarioCommunity Member Qubie ✭

    @lizb311 Thanks, I tried and it works.

Sign In to Comment