Hello All,
I am trying to compare participant's input data, compare it against the number that is randomly generated, and show different messages depending on the size.
I have created a JS code that looks as below but I can't really find a reason why it does not work. I have tried it so many different ways but I keep getting an error message that there is an unexpected token {.
Qualtrics.SurveyEngine.addOnReady(function()
{
if (${e://Field/RandomAssetNo} > ${q://QID130/ChoiceTextEntryValue}) {
"Your earnings will be 0";
} else {
"Your earnings will be (${e://FieldRandomAssetNo - ${q://QID130/ChoiceTextEntryValue)";
});
My two questions would be:
(1) Can I bring participant inputted values and randomly generated number like above?
(2) What else wrong am I doing with the code there?
I would appreciate any of your help!
Thanks!
(Using JS) Bringing participant's input data and comparing it against the random number generator.
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.

