Piped Text Help! Pipe Specific Section | XM Community
Solved

Piped Text Help! Pipe Specific Section

  • 26 February 2024
  • 5 replies
  • 43 views

Userlevel 6
Badge +5

Hello

Hope everyone is well.

In a survey question I ask for a URL.

The URL will always end with 8 digits, for example...

/12345678

How can I pipe just the 8 digits into a forthcoming question in the same survey.

Thanks :) 🤞

 

icon

Best answer by ahmedA 26 February 2024, 11:59

View original

5 replies

Userlevel 7
Badge +21
Qualtrics.SurveyEngine.addOnReady(function () {
const quest = this;
const qc = quest.getQuestionContainer();
const inputBox = qc.querySelector(".InputText");

inputBox.oninput = function (ev) {
const text = ev.target.value;
const last8 = text.slice(text.length - 8);
Qualtrics.SurveyEngine.setEmbeddedData("last8", last8);
};
});

 

Userlevel 7
Badge +21

You can access it using the ED last8

Userlevel 6
Badge +5

Amazing, thanks :)

Userlevel 6
Badge +5

Hi @ahmedA 

This has been working well, thanks so much!

I want to do exactly the same as the above, but this time just pipe forward how ever many digits (will always be numbers) are at the end of a URL. The digits will also follow after a;

/

Hope you can help again! 🥷

Thanks :)

Userlevel 7
Badge +21

Change the last8 line to: 

const last8 = text.split("/")[text.split("/").length - 1];

 

Leave a Reply