how access dynamically generated template literals in JS | XM Community
Skip to main content

Dear all,
The scenario is as follows: I have around 20 hot spot questions. However the respondent will see only one question and hence I want to summarize the results in one embedded data field. Therefore I want to create an multi-text embedded data field
I managed to collect all information and can create the template literal ${q://QID1/ChoiceGroup/SelectedAnswers/1} dynamically dependent on the question which has been shown.
However, instead of the value, only the dynamically created string is stored and not the answer values.
the code looks like this:

let concept_likes_qId = "${e://Field/concept_likes_qId}"
let concept_likes_regionCodes ="${e://Field/concept_likes_regionCodes}".split(',');
let concept_likes_regionTexts ="${e://Field/concept_likes_regionTexts}".split(',');
let concept_likes_results = new Array
let varName 
let result
for(let i=0;i varName ="\\$\\{q:\\/\\/" + concept_likes_qId + "\\/ChoiceGroup/SelectedAnswers\\/"+concept_likes_regionCodessi]+"\\}"
result = varName
concept_likes_results.push(result)
}
Thanks everyone in advance for your support.

Best regards
Rudi


Be the first to reply!

Leave a Reply