Using Embedded Data from a scored question in javascript | XM Community
Question

Using Embedded Data from a scored question in javascript

  • 29 October 2018
  • 1 reply
  • 67 views

Hi there,

I'm having some trouble getting my js code to work. I have used qualtrics' scoring feature to score some questions, and now want to use js to pull those scores to make some calculations. See the beginning of the code below:

var C2A;
var C2;
var C3;
var C4;
var C5;
var C7;
var C2A_troubleA;
var asleep_bed;
var PSQI_score;
var C1;
var min_fall;
var C6;
var trouble_A;
var hours_sleep;
var hours_bed;
var trouble_bj;
var awake_enthus;

Qualtrics.SurveyEngine.getEmbeddedData("C1") ;
Qualtrics.SurveyEngine.getEmbeddedData("min_fall") ;
Qualtrics.SurveyEngine.getEmbeddedData("C6") ;
Qualtrics.SurveyEngine.getEmbeddedData("trouble_A") ;
Qualtrics.SurveyEngine.getEmbeddedData("hours_sleep") ;
Qualtrics.SurveyEngine.getEmbeddedData("hours_bed") ;
Qualtrics.SurveyEngine.getEmbeddedData("trouble_bj") ;
Qualtrics.SurveyEngine.getEmbeddedData("awake_enthus") ;

min_fall = parseFloat(min_fall) ;
hours_sleep = parseFloat(hours_sleep) ;
hours_bed = parseFloat(hours_bed) ;
C1 = parseInt(C1)
C6 = parseInt(C6)
trouble_A = parseInt(trouble_A)
trouble_bj = parseInt(trouble_bj)
awake_enthus = parseInt(awake_enthus)

Where C1, min_fall, C6, trouble_A, hours_sleep, hours_bed, trouble_bj, awake_enthus have already been set in embedded data from question scores or text entry

However, for questions that were scored, I am having trouble. The score values do not seem to transfer over to the js code.

Thank you for any help you can provide.

1 reply

Userlevel 7
Badge +27
Hi @awall650 ,
did you try piping the scoing scores into an embedded data and then using `Qualtrics.SurveyEngine.getEmbeddedData("") ;` to get the value in that embedded data ?

Leave a Reply