Remove First 7 Characters From Piped Text in Survey | XM Community
Skip to main content
Solved

Remove First 7 Characters From Piped Text in Survey

  • July 28, 2022
  • 1 reply
  • 73 views

I have a survey which is pulling in products a customer has ordered as part of a multiple choice question. In their current state they are populating like "123456 Flank Steak" what I'd like to do is have it simply output as "Flank Steak".
The piped text looks like - ${e://Field/shippingProduct0}
I think this is a matter of using substring(7)
But I'm unclear on where I should be adding this into my survey. Any help is greatly appreciated!

Best answer by TomG

Put the pipe in a and update the contents:
HTML:
${e://Field/shippingProduct0}
JS:
Qualtrics.SurveyEngine.addOnload(function() {
var product = jQuery("#product");
product.text(product.text().substring(7));
});

1 reply

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • July 29, 2022

Put the pipe in a and update the contents:
HTML:
${e://Field/shippingProduct0}
JS:
Qualtrics.SurveyEngine.addOnload(function() {
var product = jQuery("#product");
product.text(product.text().substring(7));
});