Forum Discussion

SamanthaWrig962's avatar
SamanthaWrig962
Community Member
8 days ago

How to get an LMS report to show number of quiz attempts?

I tried searching online for how to get Cornerstone LMS to report the number of attempts a learner takes in a quiz while staying in the quiz and just selecting Retry (aka not closing the scorm and starting again later). I followed all of the instructions on using a variable and then a javascript file to pull into the suspend_data reporting field. But nothing I have tried is getting the variable to report correctly in Suspend_data.  Anyone have any ideas? I have attached just a silly sample quiz that I was using to test this.

Below is the variable I used:

 

Below is the javascript that I put to trigger when the timeline starts on the success layer of the results slide: 

var player = GetPlayer();
var attemptCount = player.GetVar("AttemptCount");
var customData = {
    attemptCount: attemptCount
};
var suspendData = JSON.stringify(customData);
// Reference to LMS API (should work in SCORM Cloud, Cornerstone, etc.)
var lmsAPI = parent;
// Send custom suspend_data
if (typeof lmsAPI.SetSuspendData === "function") {
    lmsAPI.SetSuspendData(suspendData);
} else if (typeof lmsAPI.SetValue === "function") {
    lmsAPI.SetValue("cmi.suspend_data", suspendData);
}
// Commit the data
if (typeof lmsAPI.Commit === "function") {
    lmsAPI.Commit("");
}



2 Replies

  • JHauglie's avatar
    JHauglie
    Community Member

    Disclaimer: We do not use (and I have never used) Cornerstone as an LMS.

    Suggestion: You probably want to publish to some version of xAPI in order to capture the data you are trying to get. You are correct that it should be reported in Cornerstone but I could not tell you where to start beyond what you have done.

  • Nedim's avatar
    Nedim
    Community Member

    This line lmsAPI = parent doesn’t actually get the SCORM API, it just gives you access to the parent window object. Unless the SCORM API object (like API_1484_11) is directly exposed on parent, this won't work. What you should do is search inside parent for API_1484_11. Keep in mind that if you set new custom suspend data without first reading and merging the existing data, you will overwrite and erase whatever was previously stored in cmi.suspend_data. Example: