Piped Text Help! Pipe Specific Section | XM Community
Skip to main content

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 🙂 🤞

 

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

 


You can access it using the ED last8


Amazing, thanks :)


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 :)


Change the last8 line to: 

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

 


Leave a Reply