Conditionally pull a second value from contact list based on answer selection | XM Community
Skip to main content

In the survey I am building, respondents may select multiple options from a list of titles, each of which is associated with one or more dates. The list of titles and their dates is different for each respondent, and will be stored in a contact list.

Based on the subset of titles a respondent selects, I would like to retrieve all the relevant dates so I can ask questions pertaining to those dates. Is there a good way to reference and then filter the embedded data from the contact list based on selected values? 

I suspect JavaScript will be important here, but it’s not my strong suit.

 

To clarify, suppose we had a contact list formatted like this:

email address titles dates
one@example.com “Yes, this is an example.” || “Another example might look like this.” 2021 || 2018
two@example.com “I have a lot of titles to my name.” || “This title is not like the others.” || “Another example might look like this.” 2017 || 2022 || 2018

 

I am then posing a question like, “Which of these titles do you recognize?” and piping in something like ${e://Field/titles} as the answer choices. If user two checks yes for the first and second option, but not the third, I want to be able to say something like, “The titles you selected are associated with the following years: 2017, 2022. We’ll now ask you questions about those years,” and then loop over the list.

Can this be done?

 

PS: I’m also still figuring out how to split the multiple values when passing to the answer field. I can’t use commas as a delineating mark because the values themselves will contain commas, but I assume I can treat the embedded data field as a string and use split() somewhere.

Be the first to reply!

Leave a Reply