[Xerte] Re: reading quizScoreTracking.sum() and quizScoreTracking.length
Julian Tenney
Julian.Tenney at nottingham.ac.uk
Tue Sep 13 09:47:27 BST 2011
When you turn the page, the quiz icon no longer exists. You'll need to modify the quiz model to put the data somewhere that will still exist after the page turns: rootIcon.quizResults.score for example.
I'd make a generic solution if I could think how best to do it: you might have more than one quiz in an rlo. It would probably be worth initialising a tracking array, with an entry for each page to store data, then you could put results in from any page:
rootIcon.trackingData = new Array();
//loop over the xml and initialise an object / value for each
for (i = 0 to number of pages in rlo){
rootIcon.trackingData[i] = new Object();
}
Then you can store data in the array based on rootIcon.currentPage, i.e.
rootIcon.trackingData[rootIcon.currentPage].score = 99;
and finally loop back over the array to fish the results out and display them / submit them / whatever.
From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of KnowledgeWare
Sent: 13 September 2011 04:57
To: Xerte discussion list
Subject: [Xerte] reading quizScoreTracking.sum() and quizScoreTracking.length
I'm running toolkits and have a final quiz (quiz.rlm) with scorm tracking turned on. Everything works fine. I wanted to add another page which displays the score (again) then makes a decision about printing a certificate.
I've created a model in desktop xerte which is basically a text page and a script icon which writes to this text page, then imported the model as the next icon after the quiz. I'm trying to grab the value of 'quizScoreTracking.sum' and 'quizScoreTracking.length' and display it on the 'welcometext' page like this:
welcometext.setText('You got ' + quizScoretracking.sum() + ' correct out of a total of ' + quizScoreTracking.length + ' questions. Your score is: ' + score + '%');
When I run it however I get:
"You got undefined correct out of a total of undefined questions. Your score is: NaN%"
Am I doing something wrong...or do these variables get purged when the quiz icon is passed?
TIA
RonM2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20110913/62fa239d/attachment.html>
More information about the Xerte
mailing list