Stripping first two characters from piped text ${q://QID18/ChoiceTextEntryValue} | XM Community
Solved

Stripping first two characters from piped text ${q://QID18/ChoiceTextEntryValue}

  • 3 September 2019
  • 1 reply
  • 30 views

Userlevel 3
Badge
I insert piped text ${q://QID18/ChoiceTextEntryValue} into different other questions, use it in display logic, branching conditions as well as within email trigger.
Now I need to insert text obtained from string ${q://QID18/ChoiceTextEntryValue} by removing the first two characters. For example, ${q://QID18/ChoiceTextEntryValue} is 'CP104A', then I need to be able to insert text '104A' into questions. Can it be achieved with RegEx expression?
The original string ${q://QID18/ChoiceTextEntryValue} should not be changed.
I am new to Qualtrics and not yet familiar with JavaScript.
Thanks!
icon

Best answer by KimothiSaurabh 3 September 2019, 11:48

View original

1 reply

Userlevel 4
Badge +18
I think there is no way to directly manipulate piped text so you can try below workaround.

Put `<span class="trimT"></span>` where you want to pipe the text and then in javascript write below code:-
var pText = "${q://QID18/ChoiceTextEntryValue}"
jQuery('.trimT').html(pText.slice(2,pText.length));

Leave a Reply