Ran into a quandary. Can you help?
The Javascript is only concatenating the first few (3 to be exact) selections with "::" for multiple different fields. When more than 3 items are selected, there is no “::” only “,”
Example: Three or less selected:
- PERFECT: City of Fishers::Community Physician Network::Community Physician Network - All::CPN Providers
- NOT PERFECT (MORE THAN 3 SELECTED): ACO, Ambulatory Pharmacy, Analytics Associate Feedback, Infusion, Inpatient, Inpatient Psych - Fairbanks
Here is my code - any thoughts/what can I do to update this to capture more than 3 selections?:
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
var string = '${q://QID5/ChoiceGroup/SelectedChoices}';
var new1=string.replace(/\\s*,\\s*/g, ",");
var replacestring= new1.replace(/,/g , '::');
console.log(replacestring)
console.log(new1)
Qualtrics.SurveyEngine.setEmbeddedData( 'Role', replacestring );
});
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
var string = '${q://QID50/ChoiceGroup/SelectedChoices}';
var new1=string.replace(/\\s*,\\s*/g, ",");
var replacestring= new1.replace(/,/g , '::');
console.log(replacestring)
console.log(new1)
Qualtrics.SurveyEngine.setEmbeddedData( 'Product Line', replacestring );
});
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
var string = '${q://QID62/ChoiceGroup/SelectedChoices}';
var new1=string.replace(/\\s*,\\s*/g, ",");
var replacestring= new1.replace(/,/g , '::');
console.log(replacestring)
console.log(new1)
Qualtrics.SurveyEngine.setEmbeddedData( 'Specialty/Region', replacestring );
});
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
var string = '${q://QID53/ChoiceGroup/SelectedChoices}';
var new1=string.replace(/\\s*,\\s*/g, ",");
var replacestring= new1.replace(/,/g , '::');
console.log(replacestring)
console.log(new1)
Qualtrics.SurveyEngine.setEmbeddedData( 'Sub-Specialty/Sub-Region', replacestring );
});