Hi All. I have some large essay response fields that need to save to a panel via a workflow trigger. The embedded data fields in the panel are capped at 1024 characters and much too short. I want to generate embedded data fields in the survey that will then be saved to the panel via workflows. Is there a way to create an embedded data field set to equal the text response of a question, but ONLY capture characters 1-1000. I would then create follow-up embedded data fields set to characters 1001-2000, and so on. Here is an example of the field I am looking to take only the first 1000 characters from: ${q://QID40/ChoiceTextEntryValue}
Set Embedded Data off of portion of text response
Best answer by Deepak
Qualtrics.SurveyEngine.addOnload(function() {
var that = this;
function splitTextIntoChunks(text, chunkSize) {
var chunks = [];
for (var i = 0; i < text.length; i += chunkSize) {
chunks.push(text.substring(i, i + chunkSize));
}
return chunks;
}
function setEmbeddedDataFields(text) {
var chunks = splitTextIntoChunks(text, 1000);
for (var i = 0; i < chunks.length; i++) {
var embeddedDataFieldName = "ResponsePart" + (i + 1);
Qualtrics.SurveyEngine.setEmbeddedData(embeddedDataFieldName, chunks[i]);
//console.log(embeddedDataFieldName + ": " + chunks[i]);
}
}
var qid = this.questionId;
var textField = document.getElementById(qid).querySelector('.InputText');
textField.addEventListener('input', function() {
var textResponse = textField.value;
setEmbeddedDataFields(textResponse);
});
});
Your embedded datas will be named as
ResponsePart1
ResponsePart2
ResponsePart3 and so on these will be created automatically after every 1000 chars.
Hope it helps!
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
