In a matrix question, I want a line break between "Strongly agree" and "5" but not for mobile | XM Community
Skip to main content
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.
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}`
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:

!
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.
> @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.
> @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.
> @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
@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