How do I embed a segmentation algorithm into a survey? | XM Community
Skip to main content
Hi there

I have a short survey I need to set-up - it is a matrix question with 7 statements asked on a 5-point Likert agreement scale.

What I need to implement in the survey is a hidden algorithm and page which allocates the respondent to 1 of 5 groups dependent on their responses to the 7 statements. The logic blocks for each segment are mutually exclusive and together cover all possible combinations of the input variables.

I already have the segmentation allocation code - in SQL and VBA syntax. It is essentially a large composite block of AND/OR statements.

I am not a programmer or coder though - how do I set this up in Qualtrics? Would SQL or VBA suffice, or do I need to tweak the code to JavaScript?

Thanks
I'm not sure if SQL or VBA will work in Qualtrics. But if it is just a bunch of And/Or statements you should be able to build this using branch logic and embedded data in the Survey flow.



Relevant help pages:

* Survey Flow: https://www.qualtrics.com/support/survey-platform/survey-module/survey-flow/survey-flow-overview/

* Branch Logic: https://www.qualtrics.com/support/survey-platform/survey-module/survey-flow/standard-elements/branch-logic/

* Embedded Data: https://www.qualtrics.com/support/survey-platform/survey-module/survey-flow/standard-elements/embedded-data/
Thank you - the branch logic and embedded data looks to be what I will need.



However - the And/Or statements are multiple and complex. Here's an example of how 1 of the 5 segments is allocated. S referring to the statement (and needs adapting to reflect the logic that would be present in the survey) and the 1-5 numbers reflecting the score on the agreement scale (again, code needs adapting to reflect survey logic)



So I need to avoid setting this up as a manual connection and instead to embed an amended version of the code below that would be suitable for Qualtrics?



(S7 IN(1, 2) And (S4 IN(1, 2) And S1 IN(4, 5) And (S3 IN(1, 2) And S6 IN(1, 2) And S5 IN(1, 2, 3) And S2 IN(2) And S5 IN(2) And S3 IN(2, 3, 4, 5) Or S3 IN(3, 4, 5) And (S6 IN(1, 3) And (S2 IN(1, 2, 3) And S3 IN(1, 2, 5) And S1 IN(1, 2, 3, 5) Or S2 IN(4, 5) And S5 IN(2) And S2 IN(4) And S3 IN(3)) Or S6 IN(2, 4, 5) And S2 IN(1, 2, 3, 5) And S2 IN(2, 3) And S6 IN(1, 3, 4, 5) And S5 IN(4, 5) And S1 IN(1, 2, 3, 5))) Or S4 IN(3, 4, 5) And S1 IN(3, 4, 5) And S4 IN(1, 2, 4, 5) And S3 IN(3, 4, 5) And S2 IN(1, 2, 3, 5) And S3 IN(3) And S1 IN(1, 2, 3, 5) And S5 IN(3, 4, 5) And S1 IN(1, 2, 4, 5)) Or S7 IN(3, 4, 5) And (S1 IN(1, 2, 3) And (S1 IN(1) And (S2 IN(1) Or S2 IN(2, 3, 4, 5) And S3 IN(2) And S2 IN(3) And S4 IN(2)) Or S1 IN(2, 3, 4, 5) And (S6 IN(2) And (S2 IN(1, 2) And (S7 IN(3) And S3 IN(1, 2, 5) And S1 IN(2) Or S7 IN(1, 2, 4, 5) And S5 IN(2, 3, 4, 5)) Or S2 IN(3, 4, 5) And (S3 IN(3) And (S4 IN(2) Or S4 IN(1, 3, 4, 5) And S7 IN(1, 2, 4, 5) And (S2 IN(3) And S4 IN(1, 2, 4, 5) Or S2 IN(1, 2, 4, 5))) Or S3 IN(1, 2, 4, 5) And S5 IN(2) And S4 IN(3))) Or S6 IN(1, 3, 4, 5) And (S7 IN(4) And (S2 IN(1, 2) And (S3 IN(2, 3) And S5 IN(2, 3, 4, 5) And (S4 IN(1, 2) Or S4 IN(3, 4, 5) And S6 IN(1)) Or S3 IN(1, 4, 5)) Or S2 IN(3, 4, 5) And (S6 IN(3) And S3 IN(1, 4) And S2 IN(3) Or S6 IN(1, 2, 4, 5) And (S5 IN(1, 3) Or S5 IN(2, 4, 5) And (S2 IN(4) And S4 IN(2, 3) Or S2 IN(1, 2, 3, 5) And S4 IN(1, 4, 5))))) Or S7 IN(1, 2, 3, 5) And (S4 IN(1, 2, 3) And S3 IN(2, 3, 4, 5) And (S7 IN(3) And S2 IN(1, 3, 4, 5) And (S3 IN(2, 3) Or S3 IN(1, 4, 5)) Or S7 IN(1, 2, 4, 5)) Or S4 IN(4, 5) And S3 IN(2, 4) And S2 IN(1, 4, 5))))) Or S1 IN(4, 5) And (S7 IN(3) And (S4 IN(1, 2) And (S6 IN(2, 3) And (S3 IN(3, 4) And (S5 IN(2) And S2 IN(3) And (S6 IN(2) And S1 IN(1, 2, 3, 5) Or S6 IN(1, 3, 4, 5)) Or S5 IN(1, 3, 4, 5) And S2 IN(2) And S3 IN(3)) Or S3 IN(1, 2, 5)) Or S6 IN(1, 4, 5) And S1 IN(4) And S2 IN(3) And S3 IN(1, 3, 4, 5)) Or S4 IN(3, 4, 5) And (S3 IN(3, 4) And S4 IN(3) And (S2 IN(2) And S1 IN(1, 2, 3, 5) And S3 IN(1, 2, 4, 5) Or S2 IN(1, 3, 4, 5)) Or S3 IN(1, 2, 5) And (S1 IN(4) And S2 IN(3, 4, 5) And S4 IN(1, 2, 4, 5) Or S1 IN(1, 2, 3, 5) And S4 IN(3, 4)))) Or S7 IN(1, 2, 4, 5) And (S4 IN(4) And S2 IN(1, 2, 3, 4) And (S6 IN(1, 2) And (S7 IN(4) Or S7 IN(1, 2, 3, 5)) Or S6 IN(3, 4, 5) And (S5 IN(2) And (S3 IN(2, 3) And S2 IN(2) Or S3 IN(1, 4, 5) And (S2 IN(3) Or S2 IN(1, 2, 4, 5) And S3 IN(1, 2, 3, 5))) Or S5 IN(1, 3, 4, 5) And (S3 IN(2, 4) Or S3 IN(1, 3, 5) And (S2 IN(1, 2) And S7 IN(1, 2, 3, 5) Or S2 IN(3, 4, 5))))) Or S4 IN(1, 2, 3, 5) And (S2 IN(1) And S3 IN(3) Or S2 IN(2, 3, 4, 5) And S5 IN(1, 2, 3, 4) And (S5 IN(1, 3) And (S4 IN(1) And (S6 IN(1, 4) And S2 IN(1, 2, 4, 5) Or S6 IN(2, 3, 5) And (S1 IN(4) Or S1 IN(1, 2, 3, 5))) Or S4 IN(2, 3, 4, 5) And (S3 IN(2, 3, 4) And (S2 IN(4) Or S2 IN(1, 2, 3, 5)) Or S3 IN(1, 5))) Or S5 IN(2, 4, 5) And (S3 IN(1, 2, 3, 4) And (S6 IN(4) And (S2 IN(3) Or S2 IN(1, 2, 4, 5)) Or S6 IN(1, 2, 3, 5)) Or S3 IN(5) And S2 IN(1, 2, 4, 5))))))))

Leave a Reply