How To Capture Statuses And Scores From AICC/SCORM Compliant Content

How To Capture Statuses And Scores From AICC/SCORM Compliant Content


Some content vendors include logging utilities with their content that will capture AICC transactions. Please check with your vendor to see whether such logging abilities are provided.
There is a number of vendors who use Java for communication with LMSs. Using Java Console in the browser may show the AICC data being passed as well.
If those methods cannot be used, the following code can be added to ELM to output statuses and scores into a flat file.

For AICC:

Open record WEBLIB_LM_LELM, field LM_ISCRIPT, FieldFormula PeopleCode event and add the following (there are two disctinct places where this code goes).

/**
 *IScript which will be called for AICC-HACP communication
 */
Function IScript_HACP_COMM()
   <****Testing code *****/*
   &sep = Char(13) | Char(10);
   Local string &s = "error=0" | &sep | "version=1.2" | &sep | "aicc_data=[core]" | &sep | "student_ID=aicc-user01" | &sep | "student_name=PS,TB" | &sep | "Output_file=" | &sep | "credit=C" | &sep | "lesson_location=" | &sep | "lesson_mode=sequential" | &sep | "lesson_status=Not Attempted" | &sep | "path=" | &sep | "score=" | &sep | "time=00:23:15";
 
   %Response.SetContentType("text/plain");
   %Response.WriteLine(&s);
   Return;
    /*****End of Testing code **************/*>
 
   /******New Code For Capture**********/
   Local File &DummyFile = GetFile("c:\\temp\\output.txt", "A", %FilePath_Absolute);
   &DateTime = %Datetime;
   &DummyFile.WriteLine(&DateTime);
   &DummyFile.WriteLine("-----------Begin Request Param List----------");
   &meter_array = %Request.GetParameterNames();
   For &i = 1 To ¶meter_array.len
      &meter_name = ¶meter_array [&i];
      &meter_value = %Request.GetParameter(¶meter_name);
      &DummyFile.WriteLine(¶meter_name | " = " | ¶meter_value);
   End-For;
   &DummyFile.WriteLine("-----------End Request Param List------------");
 
 
   /*Get the command , session id and the AICC_Data from the input and pass it for processing */
   Local string &str_Command = %Request.GetParameter("command");
   Local string &str_SessionId = %Request.GetParameter("session_id");
   Local string &str_AiccData = Unencode(%Request.GetParameter("AICC_Data"));
 
   /*Extract the Enrollment Id , LC id and the AU Id */
   Local LEM_UTILITIES:Utility &hacpCommUtil = create LEM_UTILITIES:Utility();
   Local array of string &ar_SplitArr = &hacpCommUtil.SplitString(&str_SessionId, ":", 0, 0);
   Local number &nbr_EnrollmentId;
   Local number &nbr_LCId;
   Local string &str_AUId;
   If (&ar_SplitArr.Len <> 3) Then
      &nbr_EnrollmentId = &hacpCommUtil.TEST_ENROLLMENT_ID;
      &nbr_LCId = 1;
      &str_AUId = "1";
   Else
      &nbr_EnrollmentId = Value(&ar_SplitArr [1]);
      &nbr_LCId = Value(&ar_SplitArr [2]);
      &str_AUId = &ar_SplitArr [3];
   End-If;
   Local LEM_COMM:CommHandler &aiccObj = create LEM_COMM:CommHandler(&hacpCommUtil, &hacpCommUtil.AHACP, &nbr_EnrollmentId, &nbr_LCId, &str_AUId);
   Local LEM_UTILITIES:StringHashtable &hsh_TrackHash = Null;
   Local string &str_HACPResponse = "";
   /*Depending on the command, call the appropriate methods */
   Evaluate Upper(&str_Command)
   When "GETPARAM"
      /*For query, get the Tracking data for the given SCO and enrollment id */
      &hsh_TrackHash = &aiccObj.GetTrackingData();
      /*If no tracking data was found, return a 'invalid sessionid error */
      If (&hsh_TrackHash = Null) Then
         &str_HACPResponse = &aiccObj.FormHACPResponse("3", "");
      Else
         /*Form the Response String */
         &str_HACPResponse = &aiccObj.FormHACPResponse("0", &aiccObj.FormAiccData(&hsh_TrackHash));
      End-If;
      Break;
    
   When "PUTPARAM"
      /*For update, Update the existing tracking data for the given SCO and enrollment id and write out
           errorcode of 0
          */
      If (&nbr_EnrollmentId <> &hacpCommUtil.TEST_ENROLLMENT_ID) Then
         /*Populate a hashtable with the new data */
         Local LEM_UTILITIES:StringHashtable &hsh_NewTrackHash = &aiccObj.ParseAiccData(&str_AiccData);
         If (&hsh_NewTrackHash <> Null) Then
            /*Calculate total time and populate that value also */
            &hsh_TrackHash = &aiccObj.GetTrackingData();
            Local string &str_TotalTime;
            try
               &str_TotalTime = &hacpCommUtil.AddTime(&hsh_NewTrackHash.Get("cmi.core.session_time"), &hsh_TrackHash.Get("cmi.core.total_time"));
            catch Exception &ex
               &str_TotalTime = &hsh_NewTrackHash.Get("cmi.core.session_time");
            end-try;
            &hsh_NewTrackHash.Put("cmi.core.total_time", &str_TotalTime);
            &hsh_TrackHash = &aiccObj.UpdateTrackingData(&hsh_NewTrackHash);
         End-If;
      End-If;
      /*Form the response string */
      &str_HACPResponse = &aiccObj.FormHACPResponse("0", "");
      Break;
    
   When "EXITAU"
      Local LEM_DB:DBManager &dbObj = create LEM_DB:DBManager(create LEM_UTILITIES:Utility());
      Local string &str_ScoId = &str_AUId;
      Local LEM_UTILITIES:Utility &dispMenuUtilObj = create LEM_UTILITIES:Utility();
      If &dispMenuUtilObj.LOGOUT Then
         If &dbObj.DidLessonLogOut(&nbr_EnrollmentId, &nbr_LCId, &str_ScoId) Then
            &dbObj.UpdateLessonLogOut(&nbr_EnrollmentId, &nbr_LCId, &str_ScoId);
         End-If;
      End-If;
      /*Form the response string */
      &str_HACPResponse = &aiccObj.FormHACPResponse("0", "");
      Break;
    
   When-Other /*Invalid command */
      &str_HACPResponse = &aiccObj.FormHACPResponse("1", "");
      Break;
    
   End-Evaluate;
 
   /*********New Code for Capture**********/
   &DummyFile.WriteLine("-----------Begin HACP Response---------------");
   &DummyFile.WriteLine(&str_HACPResponse);
   &DummyFile.WriteLine("-----------End HACP Response-----------------");
   &DummyFile.WriteLine("");
   &DummyFile.WriteLine("");
   &DummyFile.WriteLine("");
   &DummyFile.Close();
 
   %Response.SetContentType("text/plain");
   %Response.Write(&str_HACPResponse);
 
 
End-Function;

The file output.txt will capture statues and scores being passed by the content that go into the LM_TRACK_STUDNT record. Please note that the file will be created on the app server machine. You should also adjust the path if you are running the app server on UNIX.
For SCORM:

You can enable JavaScript pop-ups that will give you very detailed information about communication between ELM and the content. To enable pop-ups go to the Application Designer and open HTML object LM_SCORM_API_JS_1. On line 6 set var debug = 5; and save. No app server or web server restart is necessary. You will need to navigate away from the launch page and come back to it and relaunch the content for the pop-ups to begin showing. Once done with troubleshooting, set the debug variable back to 0 in the LM_SCORM_API_JS_1 object.