In a matrix question, I want a line break between "Strongly agree" and "5" but not for mobile | XM Community
Solved

In a matrix question, I want a line break between "Strongly agree" and "5" but not for mobile

  • 31 August 2018
  • 7 replies
  • 237 views

Badge +3
Mobile display should be

1-Strongly disagree
2
3
4
5-Strongly agree


While desktop looks like this (across the page) with the text centered above the numbers:
Strongly disagree Strongly agree
1 2 3 4 5

If I add a <br> code between "disagree" and "1" it looks good for desktop but bad for mobile.
icon

Best answer by AnthonyR 31 August 2018, 18:12

View original

7 replies

Userlevel 7
Badge +7
You could set this up with survey flow and piped text.

In the flow add an embedded data element, i'll call mine `break` and set the value by default to <br/>

Then, before the question, add a branch that checks if the device type is mobile. If it is, set `break`'s value to a space, or some other delimiting character of your choice.

Finally in your question, where you want the break or other delimiter add the piped embedded data value `${e://Field/break}`
Userlevel 7
Badge +27
This isn't an answer to the question (@AnthonyR's answer is excellent), just a related item that may be of interest.

For these types of scaled numeric matrix questions, we use a JavaScript that formats the question like this:
!
Userlevel 7
Badge +33
You can also add 7 options say:-

1-Strongly disagree,1,2,3,4,5,5-Strongly agree

On First option "1-Strongly disagree" add display logic as if devicetype=mobile.
on second option "1" display logic as if devicetype IS NOT mobile.

Similarly for 6th and 7th option (5 and 5-Strongly agree). Here you needs not to create embedded variable.
Userlevel 7
Badge +27
> @bansalpeeyush29 said:
> You can also add 7 options say:-
>
> 1-Strongly disagree,1,2,3,4,5,5-Strongly agree
>
> On First option "1-Strongly disagree" add display logic as if devicetype=mobile.
> on second option "1" display logic as if devicetype IS NOT mobile.
>
> Similarly for 6th and 7th option (5 and 5-Strongly agree). Here you needs not to create embedded variable.

That will display correctly, but it will mess up the data...strongly disagree and strongly disagree will be different answers on mobile and desktop.
Userlevel 7
Badge +33
> @TomG said:
> > @bansalpeeyush29 said:
> > You can also add 7 options say:-
> >
> > 1-Strongly disagree,1,2,3,4,5,5-Strongly agree
> >
> > On First option "1-Strongly disagree" add display logic as if devicetype=mobile.
> > on second option "1" display logic as if devicetype IS NOT mobile.
> >
> > Similarly for 6th and 7th option (5 and 5-Strongly agree). Here you needs not to create embedded variable.
>
> That will display correctly, but it will mess up the data...strongly disagree and strongly disagree will be different answers on mobile and desktop.

You can recode data back to 1 and 5, say you get 7 precodes, you just need to recode it to 1 and 5 only, nothing mess . You can do same in question recode or vocalize or reporting or after data pull.
Badge +5
> @TomG said:
> This isn't an answer to the question (@AnthonyR's answer is excellent), just a related item that may be of interest.
>
> For these types of scaled numeric matrix questions, we use a JavaScript that formats the question like this:
> !

Hi @TomG ,
that't exactly what I'm looking for - what is the JS code for this solution?
I have the problem that I would like to force Qualtrics to the Accordion Format for my matrix table questions, so that my matrix is displayed vertically. Qualtric only does it when the answer option is wide enough. Your solution would be a good alternative!

Many thanks, Laura
Userlevel 7
Badge +27
@Lee783,

To force an accordion on any screen, make the first column wider than your theme by dragging divider bar right:
!

The script you asked about isn't something we give away, but contact me by private message if you still have an interest in it. It has lots of configurable features.

Leave a Reply