Need solution for a unique problem | XM Community
Skip to main content
I am creating a pre-screener where we are receiving ids in a unique format e.g. vbd155727_hgdsjSGdsuyegwuahs , I want to know if its possible for me to trim vbd155727_ and just send hgdsjSGdsuyegwuahs into my client link at the time of final redirection under a specific variable.
Hi @KGParadigm , I found this on a previous post and it may be what you are looking for. It allowed me to create an ED field that only contained a certain range of characters from a field.



Replace "ResponseID with the field you want. Replace the "13" and "18" with the character ranges you want to send. Replace "PatientID" with the name of the new ED field you want. Hope this helps!



`Qualtrics.SurveyEngine.addOnReady(function()

{

/*Place your JavaScript here to run when the page is fully displayed*/

var str = " ${e://Field/ResponseID}";

var res = str.substr(13,18);

Qualtrics.SurveyEngine.setEmbeddedData("PatientID", res);

});`
Hey @KGParadigm, here's how I think I'd tackle this using a `split()`.



Qualtrics.SurveyEngine.addOnload(function()

{

// get data from an embedded data field names LinkID

var fullLinkID = "${e://Field/LinkID}";



// split the data based on your '_' formatted string and trim it

var myLinkID = fullLinkID.split("_")[1];



// overwrite your embedded data field with your new cleaned up string ID

Qualtrics.SurveyEngine.setEmbeddedData("LinkID",myLinkID);

});



Then on your client link URL redirect you would append `${e://Field/LinkID}`

Leave a Reply