I am working on this Javascript code but the output in the email does not return the percentile for each item. How could I adjust the code to address this issue?
Here is the code:
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
});
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
// Question Scores
var q1 = parseFloat("${q://QID1/SelectedAnswerRecode/1}");
var q2 = parseFloat("${q://QID2/SelectedAnswerRecode/1}");
var q3 = parseFloat("${q://QID4/SelectedAnswerRecode/1}");
var q4 = parseFloat("${q://QID3/SelectedAnswerRecode/1}");
var q5 = parseFloat("${q://QID5/SelectedAnswerRecode/1}");
var q6 = parseFloat("${q://QID6/SelectedAnswerRecode/1}");
var q7 = parseFloat("${q://QID7/SelectedAnswerRecode/1}");
var q8 = parseFloat("${q://QID8/SelectedAnswerRecode/1}");
var q9 = parseFloat("${q://QID9/SelectedAnswerRecode/1}");
var q10 = parseFloat("${q://QID10/SelectedAnswerRecode/1}");
var q11 = parseFloat("${q://QID11/SelectedAnswerRecode/1}");
var q12 = parseFloat("${q://QID12/SelectedAnswerRecode/1}");
var q13 = parseFloat("${q://QID13/SelectedAnswerRecode/1}");
var q14 = parseFloat("${q://QID14/SelectedAnswerRecode/1}");
var q15 = parseFloat("${q://QID15/SelectedAnswerRecode/1}");
var q16 = parseFloat("${q://QID16/SelectedAnswerRecode/1}");
var q17 = parseFloat("${q://QID17/SelectedAnswerRecode/1}");
var q18 = parseFloat("${q://QID18/SelectedAnswerRecode/1}");
var q19 = parseFloat("${q://QID19/SelectedAnswerRecode/1}");
var q20 = parseFloat("${q://QID20/SelectedAnswerRecode/1}");
var q21 = parseFloat("${q://QID21/SelectedAnswerRecode/1}");
var q22 = parseFloat("${q://QID22/SelectedAnswerRecode/1}");
var q23 = parseFloat("${q://QID23/SelectedAnswerRecode/1}");
var q24 = parseFloat("${q://QID24/SelectedAnswerRecode/1}");
var q25 = parseFloat("${q://QID25/SelectedAnswerRecode/1}");
var q26 = parseFloat("${q://QID26/SelectedAnswerRecode/1}");
var q27 = parseFloat("${q://QID27/SelectedAnswerRecode/1}");
var q28 = parseFloat("${q://QID28/SelectedAnswerRecode/1}");
var q29 = parseFloat("${q://QID29/SelectedAnswerRecode/1}");
var q30 = parseFloat("${q://QID30/SelectedAnswerRecode/1}");
var q31 = parseFloat("${q://QID31/SelectedAnswerRecode/1}");
var q32 = parseFloat("${q://QID32/SelectedAnswerRecode/1}");
var q33 = parseFloat("${q://QID33/SelectedAnswerRecode/1}");
var q34 = parseFloat("${q://QID255/SelectedAnswerRecode/1}");
var q35 = parseFloat("${q://QID34/SelectedAnswerRecode/1}");
var q36 = parseFloat("${q://QID35/SelectedAnswerRecode/1}");
var q37 = parseFloat("${q://QID36/SelectedAnswerRecode/1}");
var q38 = parseFloat("${q://QID37/SelectedAnswerRecode/1}");
var q39 = parseFloat("${q://QID38/SelectedAnswerRecode/1}");
var q40 = parseFloat("${q://QID39/SelectedAnswerRecode/1}");
var q41 = parseFloat("${q://QID40/SelectedAnswerRecode/1}");
var q42 = parseFloat("${q://QID40/SelectedAnswerRecode/1}");
var q43 = parseFloat("${q://QID42/SelectedAnswerRecode/1}");
var q44 = parseFloat("${q://QID42/SelectedAnswerRecode/1}");
var q45 = parseFloat("${q://QID44/SelectedAnswerRecode/1}");
var q46 = parseFloat("${q://QID45/SelectedAnswerRecode/1}");
var q47 = parseFloat("${q://QID46/SelectedAnswerRecode/1}");
var q48 = parseFloat("${q://QID47/SelectedAnswerRecode/1}");
var q49 = parseFloat("${q://QID48/SelectedAnswerRecode/1}");
var q50 = parseFloat("${q://QID49/SelectedAnswerRecode/1}");
var q51 = parseFloat("${q://QID50/SelectedAnswerRecode/1}");
var q52 = parseFloat("${q://QID51/SelectedAnswerRecode/1}");
var q53 = parseFloat("${q://QID52/SelectedAnswerRecode/1}");
var q54 = parseFloat("${q://QID53/SelectedAnswerRecode/1}");
var q55 = parseFloat("${q://QID54/SelectedAnswerRecode/1}");
var q56 = parseFloat("${q://QID55/SelectedAnswerRecode/1}");
var q57 = parseFloat("${q://QID56/SelectedAnswerRecode/1}");
var q58 = parseFloat("${q://QID57/SelectedAnswerRecode/1}");
var q59 = parseFloat("${q://QID58/SelectedAnswerRecode/1}");
var q60 = parseFloat("${q://QID59/SelectedAnswerRecode/1}");
var q61 = parseFloat("${q://QID60/SelectedAnswerRecode/1}");
var q62 = parseFloat("${q://QID61/SelectedAnswerRecode/1}");
var q63 = parseFloat("${q://QID62/SelectedAnswerRecode/1}");
var q64 = parseFloat("${q://QID63/SelectedAnswerRecode/1}");
var q65 = parseFloat("${q://QID64/SelectedAnswerRecode/1}");
var q66 = parseFloat("${q://QID65/SelectedAnswerRecode/1}");
var q67 = parseFloat("${q://QID256/SelectedAnswerRecode/1}");
var q68 = parseFloat("${q://QID66/SelectedAnswerRecode/1}");
var q69 = parseFloat("${q://QID67/SelectedAnswerRecode/1}");
var q70 = parseFloat("${q://QID68/SelectedAnswerRecode/1}");
var q71 = parseFloat("${q://QID69/SelectedAnswerRecode/1}");
var q72 = parseFloat("${q://QID70/SelectedAnswerRecode/1}");
var q73 = parseFloat("${q://QID71/SelectedAnswerRecode/1}");
var q74 = parseFloat("${q://QID72/SelectedAnswerRecode/1}");
var q75 = parseFloat("${q://QID73/SelectedAnswerRecode/1}");
var q76 = parseFloat("${q://QID74/SelectedAnswerRecode/1}");
var q77 = parseFloat("${q://QID75/SelectedAnswerRecode/1}");
var q78 = parseFloat("${q://QID76/SelectedAnswerRecode/1}");
var q79 = parseFloat("${q://QID77/SelectedAnswerRecode/1}");
var q80 = parseFloat("${q://QID78/SelectedAnswerRecode/1}");
var q81 = parseFloat("${q://QID79/SelectedAnswerRecode/1}");
var q82 = parseFloat("${q://QID80/SelectedAnswerRecode/1}");
var q83 = parseFloat("${q://QID81/SelectedAnswerRecode/1}");
var q84 = parseFloat("${q://QID82/SelectedAnswerRecode/1}");
var q85 = parseFloat("${q://QID83/SelectedAnswerRecode/1}");
var q86 = parseFloat("${q://QID84/SelectedAnswerRecode/1}");
var q87 = parseFloat("${q://QID85/SelectedAnswerRecode/1}");
var q88 = parseFloat("${q://QID86/SelectedAnswerRecode/1}");
var q89 = parseFloat("${q://QID87/SelectedAnswerRecode/1}");
var q90 = parseFloat("${q://QID88/SelectedAnswerRecode/1}");
var q91 = parseFloat("${q://QID89/SelectedAnswerRecode/1}");
var q92 = parseFloat("${q://QID90/SelectedAnswerRecode/1}");
var q93 = parseFloat("${q://QID91/SelectedAnswerRecode/1}");
var q94 = parseFloat("${q://QID92/SelectedAnswerRecode/1}");
var q95 = parseFloat("${q://QID93/SelectedAnswerRecode/1}");
var q96 = parseFloat("${q://QID94/SelectedAnswerRecode/1}");
var q97 = parseFloat("${q://QID95/SelectedAnswerRecode/1}");
var q98 = parseFloat("${q://QID96/SelectedAnswerRecode/1}");
var q99 = parseFloat("${q://QID97/SelectedAnswerRecode/1}");
var q100 = parseFloat("${q://QID98/SelectedAnswerRecode/1}");
var q101 = parseFloat("${q://QID99/SelectedAnswerRecode/1}");
var q102 = parseFloat("${q://QID100/SelectedAnswerRecode/1}");
var q103 = parseFloat("${q://QID101/SelectedAnswerRecode/1}");
var q104 = parseFloat("${q://QID102/SelectedAnswerRecode/1}");
var q105 = parseFloat("${q://QID103/SelectedAnswerRecode/1}");
var q106 = parseFloat("${q://QID104/SelectedAnswerRecode/1}");
var q107 = parseFloat("${q://QID105/SelectedAnswerRecode/1}");
var q108 = parseFloat("${q://QID106/SelectedAnswerRecode/1}");
var q109 = parseFloat("${q://QID107/SelectedAnswerRecode/1}");
var q110 = parseFloat("${q://QID108/SelectedAnswerRecode/1}");
var q111 = parseFloat("${q://QID109/SelectedAnswerRecode/1}");
var q112 = parseFloat("${q://QID110/SelectedAnswerRecode/1}");
var q113 = parseFloat("${q://QID111/SelectedAnswerRecode/1}");
var q114 = parseFloat("${q://QID112/SelectedAnswerRecode/1}");
var q115 = parseFloat("${q://QID113/SelectedAnswerRecode/1}");
var q116 = parseFloat("${q://QID114/SelectedAnswerRecode/1}");
var q117 = parseFloat("${q://QID115/SelectedAnswerRecode/1}");
var q118 = parseFloat("${q://QID116/SelectedAnswerRecode/1}");
var q119 = parseFloat("${q://QID117/SelectedAnswerRecode/1}");
var q120 = parseFloat("${q://QID118/SelectedAnswerRecode/1}");
var q121 = parseFloat("${q://QID148/SelectedAnswerRecode/1}");
var q122 = parseFloat("${q://QID149/SelectedAnswerRecode/1}");
var q123 = parseFloat("${q://QID150/SelectedAnswerRecode/1}");
var q124 = parseFloat("${q://QID151/SelectedAnswerRecode/1}");
var q125 = parseFloat("${q://QID152/SelectedAnswerRecode/1}");
var q126 = parseFloat("${q://QID153/SelectedAnswerRecode/1}");
var q127 = parseFloat("${q://QID154/SelectedAnswerRecode/1}");
var q128 = parseFloat("${q://QID155/SelectedAnswerRecode/1}");
var q129 = parseFloat("${q://QID156/SelectedAnswerRecode/1}");
var q130 = parseFloat("${q://QID157/SelectedAnswerRecode/1}");
var q131 = parseFloat("${q://QID158/SelectedAnswerRecode/1}");
var q132 = parseFloat("${q://QID159/SelectedAnswerRecode/1}");
var q133 = parseFloat("${q://QID160/SelectedAnswerRecode/1}");
var q134 = parseFloat("${q://QID161/SelectedAnswerRecode/1}");
var q135 = parseFloat("${q://QID162/SelectedAnswerRecode/1}");
var q136 = parseFloat("${q://QID163/SelectedAnswerRecode/1}");
var q137 = parseFloat("${q://QID164/SelectedAnswerRecode/1}");
var q138 = parseFloat("${q://QID165/SelectedAnswerRecode/1}");
var q139 = parseFloat("${q://QID166/SelectedAnswerRecode/1}");
var q140 = parseFloat("${q://QID167/SelectedAnswerRecode/1}");
var q141 = parseFloat("${q://QID168/SelectedAnswerRecode/1}");
var q142 = parseFloat("${q://QID169/SelectedAnswerRecode/1}");
var q143 = parseFloat("${q://QID170/SelectedAnswerRecode/1}");
var q144 = parseFloat("${q://QID171/SelectedAnswerRecode/1}");
var q145 = parseFloat("${q://QID172/SelectedAnswerRecode/1}");
var q146 = parseFloat("${q://QID173/SelectedAnswerRecode/1}");
var q147 = parseFloat("${q://QID174/SelectedAnswerRecode/1}");
var q148 = parseFloat("${q://QID175/SelectedAnswerRecode/1}");
var q149 = parseFloat("${q://QID176/SelectedAnswerRecode/1}");
var q150 = parseFloat("${q://QID177/SelectedAnswerRecode/1}");
var q151 = parseFloat("${q://QID178/SelectedAnswerRecode/1}");
var q152 = parseFloat("${q://QID179/SelectedAnswerRecode/1}");
var q153 = parseFloat("${q://QID180/SelectedAnswerRecode/1}");
var q154 = parseFloat("${q://QID181/SelectedAnswerRecode/1}");
var q155 = parseFloat("${q://QID182/SelectedAnswerRecode/1}");
var q156 = parseFloat("${q://QID183/SelectedAnswerRecode/1}");
var q157 = parseFloat("${q://QID184/SelectedAnswerRecode/1}");
var q158 = parseFloat("${q://QID185/SelectedAnswerRecode/1}");
var q159 = parseFloat("${q://QID186/SelectedAnswerRecode/1}");
var q160 = parseFloat("${q://QID187/SelectedAnswerRecode/1}");
var q161 = parseFloat("${q://QID188/SelectedAnswerRecode/1}");
var q162 = parseFloat("${q://QID189/SelectedAnswerRecode/1}");
var q163 = parseFloat("${q://QID190/SelectedAnswerRecode/1}");
var q164 = parseFloat("${q://QID191/SelectedAnswerRecode/1}");
var q165 = parseFloat("${q://QID192/SelectedAnswerRecode/1}");
var q166 = parseFloat("${q://QID193/SelectedAnswerRecode/1}");
var q167 = parseFloat("${q://QID194/SelectedAnswerRecode/1}");
var q168 = parseFloat("${q://QID195/SelectedAnswerRecode/1}");
var q169 = parseFloat("${q://QID196/SelectedAnswerRecode/1}");
var q170 = parseFloat("${q://QID197/SelectedAnswerRecode/1}");
var q171 = parseFloat("${q://QID198/SelectedAnswerRecode/1}");
var q172 = parseFloat("${q://QID199/SelectedAnswerRecode/1}");
var q173 = parseFloat("${q://QID200/SelectedAnswerRecode/1}");
var q174 = parseFloat("${q://QID201/SelectedAnswerRecode/1}");
var q175 = parseFloat("${q://QID202/SelectedAnswerRecode/1}");
var q176 = parseFloat("${q://QID203/SelectedAnswerRecode/1}");
var q177 = parseFloat("${q://QID204/SelectedAnswerRecode/1}");
var q178 = parseFloat("${q://QID205/SelectedAnswerRecode/1}");
var q179 = parseFloat("${q://QID206/SelectedAnswerRecode/1}");
var q180 = parseFloat("${q://QID207/SelectedAnswerRecode/1}");
var q181 = parseFloat("${q://QID208/SelectedAnswerRecode/1}");
var q182 = parseFloat("${q://QID209/SelectedAnswerRecode/1}");
var q183 = parseFloat("${q://QID210/SelectedAnswerRecode/1}");
var q184 = parseFloat("${q://QID211/SelectedAnswerRecode/1}");
var q185 = parseFloat("${q://QID212/SelectedAnswerRecode/1}");
var q186 = parseFloat("${q://QID213/SelectedAnswerRecode/1}");
var q187 = parseFloat("${q://QID214/SelectedAnswerRecode/1}");
var q188 = parseFloat("${q://QID215/SelectedAnswerRecode/1}");
var q189 = parseFloat("${q://QID216/SelectedAnswerRecode/1}");
var q190 = parseFloat("${q://QID217/SelectedAnswerRecode/1}");
var q191 = parseFloat("${q://QID218/SelectedAnswerRecode/1}");
var q192 = parseFloat("${q://QID219/SelectedAnswerRecode/1}");
var q193 = parseFloat("${q://QID220/SelectedAnswerRecode/1}");
var q194 = parseFloat("${q://QID221/SelectedAnswerRecode/1}");
var q195 = parseFloat("${q://QID222/SelectedAnswerRecode/1}");
var q196 = parseFloat("${q://QID223/SelectedAnswerRecode/1}");
var q197 = parseFloat("${q://QID224/SelectedAnswerRecode/1}");
var q198 = parseFloat("${q://QID225/SelectedAnswerRecode/1}");
var q199 = parseFloat("${q://QID226/SelectedAnswerRecode/1}");
var q200 = parseFloat("${q://QID227/SelectedAnswerRecode/1}");
var q201 = parseFloat("${q://QID228/SelectedAnswerRecode/1}");
var q202 = parseFloat("${q://QID229/SelectedAnswerRecode/1}");
var q203 = parseFloat("${q://QID230/SelectedAnswerRecode/1}");
var q204 = parseFloat("${q://QID231/SelectedAnswerRecode/1}");
var q205 = parseFloat("${q://QID232/SelectedAnswerRecode/1}");
var q206 = parseFloat("${q://QID233/SelectedAnswerRecode/1}");
var q207 = parseFloat("${q://QID234/SelectedAnswerRecode/1}");
var q208 = parseFloat("${q://QID235/SelectedAnswerRecode/1}");
var q209 = parseFloat("${q://QID236/SelectedAnswerRecode/1}");
var q210 = parseFloat("${q://QID237/SelectedAnswerRecode/1}");
var q211 = parseFloat("${q://QID238/SelectedAnswerRecode/1}");
var q212 = parseFloat("${q://QID239/SelectedAnswerRecode/1}");
var q213 = parseFloat("${q://QID240/SelectedAnswerRecode/1}");
var q214 = parseFloat("${q://QID241/SelectedAnswerRecode/1}");
var q215 = parseFloat("${q://QID244/SelectedAnswerRecode/1}");
var q216 = parseFloat("${q://QID245/SelectedAnswerRecode/1}");
var q217 = parseFloat("${q://QID246/SelectedAnswerRecode/1}");
var q218 = parseFloat("${q://QID247/SelectedAnswerRecode/1}");
var q219 = parseFloat("${q://QID248/SelectedAnswerRecode/1}");
var q220 = parseFloat("${q://QID249/SelectedAnswerRecode/1}");
var q221 = parseFloat("${q://QID250/SelectedAnswerRecode/1}");
var q222 = parseFloat("${q://QID251/SelectedAnswerRecode/1}");
var q223 = parseFloat("${q://QID252/SelectedAnswerRecode/1}");
var q224 = parseFloat("${q://QID253/SelectedAnswerRecode/1}");
var q225 = parseFloat("${q://QID254/SelectedAnswerRecode/1}");
// Question Groups
var denial = ((3- q1) + (3 - q2) + (3 - q3) + (3 - q4) + (3 - q5) + (3 - q6) + (3 - q7) + (3 - q8) + (3 - q9) + (3 - q10) + (3 - q11) + (3 - q12) + (3 - q13) + (3 - q14) + (3 - q15)) - 15;
var vanity = (q16 + q17 + q18 + q19 + q20 + q21 + q22 + q23 + q24 + q25 + q26 + q27 + q28 + q29 + q30) - 15;
var envy = (q31 + q32 + q33 + q34 + q34 + q35 + q36 + q37 + q38 + q39 + q40 + q41 + q42 + q43 + q44 + q45) - 15;
var resentment = (q46 + q47 + q48 + q49 + q50 + q51 + q52 + q53 + q54 + q55 + q56 + q57 + q58 + q59 + q60) - 15;
var lust = (q61 + q62 + q63 + q64 + q65 + q66 + q67 + q68 + q69 + q70 + q71 + q72 + q73 + q74 + q75) - 15;
var greed = (q76 + q77 + q78 + q79 + q80 + q81 + q82 + q83 + q84 + q85 + q86 + q87 + q88 + q89 + q90) -15;
var laziness = (q91 + q92 + q93 + q94 + q95 + q96 + q97 + q98 + q99 + q100 + q101 + q102 + q103 + q104 + q105) - 15;
var gluttony = (q106 + q107 + q108 + q109 + q110 + q111 + q112 + q113 + q114 + q115 + q116 + q117 + q118 + q119 + q120) - 15;
var humility = (q121 + q122 + q123 + q124 + q125 + q126 + q127 + q128 + q129 + q130 + q131 + q132 + q133 + q134 + q135) - 15;
var compassion = (q136 + q137 + q138 + q139 + q140 + q141 + q142 + q143 + q144 + q145 + q146 + q147 + q148 + q149 + q150) - 15;
var peacemaking = (q151 + q152 + q153 + q154 + q155 + q156 + q157 + q158 + q159 + q160 + q161 + q162 + q163 + q164 + q165) - 15;
var sexualIntegrity = (q166 + q167 + q168 + q169 + q170 + q171 + q172 + q173 + q174 + q175 + q176 + q177 + q178 + q179 + q180) - 15;
var resourcefulness = (q181 + q182 + q183 + q184 + q185 + q186 + q187 + q188 + q189 + q190 + q191 + q192 + q193 + q194 + q195) - 15;
var enthusiasm = (q196 + q197 + q198 + q199 + q200 + q201 + q202 + q203 + q204 + q205 + q206 + q207 + q208 + q209 + q210) - 15;
var physicalFitness = (q211 + q212 + q213 + q214 + q215 + q216 + q217 + q218 + q219 + q220 + q221 + q222 + q223 + q224 + q225) - 15;
var honesty = (q8 + q23 + q24 + q38 + q39 + q53 + q54 + q68 + q69 + q83 + q84 + q98 + q99 + q114 + (3 - q128) + (3 - q143) + (3 - q144) + (3 - q158) + (3 - q159) + (3 - q173) + (3 - q174) + (3 - q188) + (3 - q189) + (3 - q202) + (3 - q203) + (3 - q204) + (3 - q218) + (3 - q219)) - 28;
// Combined Scores
var truth = honesty + 15 - denial;
var respect = humility + 15 - vanity;
var concern = compassion + 15 - envy;
var anger = peacemaking + 15 - resentment;
var money = resourcefulness + 15 - greed;
var energy = enthusiasm + 15 - laziness;
var sexuality = sexualIntegrity + 15 - lust;
var health = physicalFitness + 15 - gluttony;
// total scores
var weakness = (denial + vanity + envy + resentment + greed + laziness + lust + gluttony) / 8;
var strength = (honesty + humility + compassion + peacemaking + resourcefulness + enthusiasm + sexualIntegrity + physicalFitness) / 8;
var tmi = truth + respect + concern + anger + money + energy + sexuality + health;
// z scores for the totals
var truthZScore = (truth - 26.51) / 6.52;
var respectZScore = (respect - 15.77) / 3.93;
var concernZScore = (concern - 18.75) / 4.23;
var angerZScore = (anger - 17.33) / 5.01;
var moneyZScore = (money - 17.51) / 4.26;
var energyZScore = (energy - 18.44) / 4.46;
var sexualityZScore = (sexuality - 14.47) / 5.80;
var healthZScore = (health - 17.55) / 5.25;
var honestyZScore = (honesty - 16.22) / 4.66;
var humilityZScore = (humility - 8.38) / 2.43;
var compassionZScore = (compassion - 10.11) / 2.23;
var peacemakingZSCore = (peacemaking - 8.41) / 2.73;
var resourcefulnessZScore = (resourcefulness - 8.00) / 2.47;
var enthusiasmZScore = (enthusiasm - 9.54) / 2.52;
var sexualIntegrityZScore = (sexualIntegrity - 7.50) / 3.38;
var physicalFitnessZScore = (physicalFitness - 7.67) / 3.28;
var denialZScore = (denial - 5.09) / 2.62;
var vanityZScore = (vanity - 8.19) / 2.65;
var envyZScore = (envy - 6.98) / 3.24;
var resentmentZScore = (resentment - 6.46) / 3.04;
var greedZScore = (greed - 5.88) / 2.56;
var lazinessZScore = (laziness - 6.48) / 2.70;
var lustZScore = (lust - 8.44) / 3.20;
var gluttonyZScore = (gluttony - 5.51) / 2.74;
var tmiZScore = (tmi - 152.18) / 27.72;
function GetZPercent(z)
{
//z == number of standard deviations from the mean
//if z is greater than 6.5 standard deviations from the mean
//the number of significant digits will be outside of a reasonable
//range
if ( z < -6.5)
return 0.0;
if( z > 6.5)
return 1.0;
var factK = 1;
var sum = 0;
var term = 1;
var k = 0;
var loopStop = Math.exp(-23);
while(Math.abs(term) > loopStop)
{
term = .3989422804 * Math.pow(-1,k) * Math.pow(z,k) / (2 * k + 1) / Math.pow(2,k) * Math.pow(z,k+1) / factK;
sum += term;
k++;
factK *= k;
}
sum += 0.5;
sum1=sum.toFixed(2);
return (sum1*100);
};
// Percentile Scores
var truthPercentile = GetZPercent(truthZScore);
var respectPercentile = GetZPercent(respectZScore);
var concernPercentile = GetZPercent(concernZScore);
var angerPercentile = GetZPercent(angerZScore);
var moneyPercentile = GetZPercent(moneyZScore);
var energyPercentile = GetZPercent(energyZScore);
var sexualityPercentile = GetZPercent(sexualityZScore);
var healthPercentile = GetZPercent(healthZScore);
var honestyPercentile = GetZPercent(honestyZScore);
var humilityPercentile = GetZPercent(humilityZScore);
var compassionPercentile = GetZPercent(compassionZScore);
var peacemakingPercentile = GetZPercent(peacemakingZScore);
var resourcefulnessPercentile = GetZPercent(resourcefulnessZScore);
var enthusiasmPercentile = GetZPercent(enthusiasmZScore);
var sexualIntegrityPercentile = GetZPercent(sexualIntegrityZScore);
var physicalFitnessPercentile = GetZPercent(physicalFitnessZScore);
var denialPercentile = GetZPercent(denialZScore);
var vanityPercentile = GetZPercent(vanityZScore);
var envyPercentile = GetZPercent(envyZScore);
var resentmentPercentile = GetZPercent(resentmentZScore);
var greedPercentile = GetZPercent(greedZScore);
var lazinessPercentile = GetZPercent(lazinessZScore);
var lustPercentile = GetZPercent(lustZScore);
var gluttonyPercentile = GetZPercent(gluttonyZScore);
var tmiPercentile = GetZPercent(tmiZScore);
// Set Embedded Data
Qualtrics.SurveyEngine.setJSEmbeddedData('TruthTotal', truth);
Qualtrics.SurveyEngine.setJSEmbeddedData('RespectTotal', respect);
Qualtrics.SurveyEngine.setJSEmbeddedData('ConcernTotal', concern);
Qualtrics.SurveyEngine.setJSEmbeddedData('AngerTotal', anger);
Qualtrics.SurveyEngine.setJSEmbeddedData('MoneyTotal', money);
Qualtrics.SurveyEngine.setJSEmbeddedData('EnergyTotal', energy);
Qualtrics.SurveyEngine.setJSEmbeddedData('SexualityTotal', sexuality);
Qualtrics.SurveyEngine.setJSEmbeddedData('HealthTotal', health);
Qualtrics.SurveyEngine.setJSEmbeddedData('HonestyTotal', honesty);
Qualtrics.SurveyEngine.setJSEmbeddedData('HumilityTotal', humility);
Qualtrics.SurveyEngine.setJSEmbeddedData('CompassionTotal', compassion);
Qualtrics.SurveyEngine.setJSEmbeddedData('PeacemakingTotal', peacemaking);
Qualtrics.SurveyEngine.setJSEmbeddedData('ResourcefulnessTotal', resourcefulness);
Qualtrics.SurveyEngine.setJSEmbeddedData('EnthusiasmTotal', enthusiasm);
Qualtrics.SurveyEngine.setJSEmbeddedData('SexualIntegrityTotal', sexualIntegrity);
Qualtrics.SurveyEngine.setJSEmbeddedData('PhysicalFitnessTotal', physicalFitness);
Qualtrics.SurveyEngine.setJSEmbeddedData('StrengthsTotal', strength);
Qualtrics.SurveyEngine.setJSEmbeddedData('DenialTotal', denial);
Qualtrics.SurveyEngine.setJSEmbeddedData('VanityTotal', vanity);
Qualtrics.SurveyEngine.setJSEmbeddedData('EnvyTotal', envy);
Qualtrics.SurveyEngine.setJSEmbeddedData('ResentmentTotal', resentment);
Qualtrics.SurveyEngine.setJSEmbeddedData('GreedTotal', greed);
Qualtrics.SurveyEngine.setJSEmbeddedData('LazinessTotal', laziness);
Qualtrics.SurveyEngine.setJSEmbeddedData('LustTotal', lust);
Qualtrics.SurveyEngine.setJSEmbeddedData('GluttonyTotal', gluttony);
Qualtrics.SurveyEngine.setJSEmbeddedData('WeaknessesTotal', weakness);
Qualtrics.SurveyEngine.setJSEmbeddedData('TMITotal', tmi);
// Percentile Embedded Data
Qualtrics.SurveyEngine.setJSEmbeddedData('TruthPercentile', truthPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('RespectPercentile', respectPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('ConcernPercentile', concernPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('AngerPercentile', angerPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('MoneyPercentile', moneyPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('SexualityPercentile', sexualityPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('HealthPercentile', healthPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('HonestyPercentile', honestyPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('HumilityPercentile', humilityPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('CompassionPercentile', compassionPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('PeacemakingPercentile', peacemakingPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('ResourcefulnessPercentile', resourcefulnessPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('EnthusiasmPercentile', enthusiasmPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('SexualIntegrityPercentile', sexualIntegrityPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('PhysicalFitnessPercentile', physicalFitnessPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('DenialPercentile', denialPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('VanityPercentile', vanityPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('EnvyPercentile', envyPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('ResentmentPercentile', resentmentPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('GreedPercentile', greedPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('LazinessPercentile', lazinessPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('LustPercentile', lustPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('GluttonyPercentile', glutonyPercentile);
Qualtrics.SurveyEngine.setJSEmbeddedData('TMIPercentile', tmiPercentile);
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
Thank you for your help.