Hi,
I created a custom code for calculate many variables, based on this functionality : https://api.qualtrics.com/82bd4d5c331f1-qualtrics-java-script-question-api-class
It works perfectly in test but when I use them with respondants, many times this differrents variables are note calculated. I don't understand why ? I tried to use a delay before submit, a flag var for conditionnated the click next button when this variable is ok but alway the same result.
Here is my code, many thanks for your help. I tried so many time to fix it myself but now It's an emergency for my projet :
Qualtrics.SurveyEngine.addOnload(function()
{
document.getElementById("Buttons").hidden = true;
this.questionclick = function(event,element)
{
if (element.id == 'ValidateButton')
{
var day1 = new Date("${date://CurrentDate/Y}"+"-1-1");
var degust = new Date("${date://CurrentDate/DS}");
var dachat = new Date(jQuery("[name='QR~QID67~4~TEXT']").val());
var dlc = new Date(jQuery("[name='QR~QID67~6~TEXT']").val());
var qdegust1 = new Date(degust - day1);
var qdegust2 = Math.round(qdegust1/1000/60/60/24)+1;
Qualtrics.SurveyEngine.setEmbeddedData("QUANTIEME_DEGUSTATION", qdegust2);
var qachat1 = new Date(dachat - day1);
var qachat2 = Math.round(qachat1/1000/60/60/24)+1;
Qualtrics.SurveyEngine.setEmbeddedData("QUANTIEME_ACHAT", qachat2);
var qdlc1 = new Date(dlc - day1);
var qdlc2 = Math.round(qdlc1/1000/60/60/24)+1;
Qualtrics.SurveyEngine.setEmbeddedData("QUANTIEME_DLC", qdlc2);
var delta = qdegust2 - qachat2 ;
Qualtrics.SurveyEngine.setEmbeddedData("AGE_PRODUIT_DEGUSTATION", delta);
}
{
jQuery('#NextButton').click();
}
if (element.id == 'BackButton')
{
jQuery('#PreviousButton').click();
}
}
});
questionclick function
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.


