Creating groups within a field? | XM Community
Solved

Creating groups within a field?

  • 8 March 2018
  • 3 replies
  • 21 views

Userlevel 6
Badge +45
I have a number set field called "Course Number" and I want to group them together based on the first number. For instance, anything between 1000 and 1999 should be grouped into the "1000's" group and 2000 to 2999 in the "2000's group", etc.
Is this even possible in Vocalize? If so, how can I accomplish it? Maybe by using javascript? The course number is an embedded data field so that may also be important to consider...
icon

Best answer by AnthonyR 13 March 2018, 23:47

View original

3 replies

Userlevel 4
Badge +3
Yeah! I would have another Embedded Data field called COURSE_NUMBER_GROUPING, and it could store that. There should be a way to group in Vocalize, but if you're more familiar with the JS API, then that would be a good approach! You could do it anywhere within the survey, but I would put it in the first block so that, even if they don't finish the survey, you're still able to group them in.

Just for reference, here is the code for getting and setting Embedded Data Fields with Javascript:

`Qualtrics.SurveyEngine.setEmbeddedData('FIELD', value);`
`Qualtrics.SurveyEngine.getEmbeddedData('FIELD');`
Userlevel 7
Badge +7
> @Michael_Campbell_RedPepper said:
> Yeah! I would have another Embedded Data field called COURSE_NUMBER_GROUPING, and it could store that. There should be a way to group in Vocalize, but if you're more familiar with the JS API, then that would be a good approach! You could do it anywhere within the survey, but I would put it in the first block so that, even if they don't finish the survey, you're still able to group them in.
>
> Just for reference, here is the code for getting and setting Embedded Data Fields with Javascript:
>
> `Qualtrics.SurveyEngine.setEmbeddedData('FIELD', value);`
> `Qualtrics.SurveyEngine.getEmbeddedData('FIELD');`

You could also just do each grouping with some survey flow: if CourseNumber greater than 1000 and CourseNumber less than or equal to 2000 - set courseGroup = 2000
Userlevel 6
Badge +45
Thanks @Michael_Campbell_RedPepper and @AnthonyR! I am going to try both ways and see which one I like best 🙂

Leave a Reply