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

Remove First 7 Characters From Piped Text in Survey

  • Jul 28, 2022 9:06 PM UTC
  • 1 reply
  • 84 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));
});

View original

1 reply

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • Jul 29, 2022 12:53 PM UTC

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));
});