Forum Discussion
Use JavaScript to send data to LMS with SCORM 2004 4th edition
@Carrie Thanks for posting this, really helpful!
Just checking, how would you implement this with something like Likert? I can see that there's a cmi.interactions.0.type
for it but what would be the format for the actual cmi.interactions.0.learner_response
?
Do you just have to combine the responses into one long string? I assume you can't send an array in cmi.interactions.0.learner_response
?
Thanks again for the code!
@PJ, I am so sorry that it takes me so long to respond as I am not following the thread.
I never used Likert type with this code before as I discovered the default Likert responses were not reader-friendly in Workday Learning. So in a situation like this, I built my own Likert and stored information and used fill-in type.
You can use array in the code. When you use array, you will end up having multiple "rows" in your final report. See partial code below using for loop with array:
(forgive me for my sloppy coding. I didn't start var i with 0 because I had the question# setup starting with 1 in SL and didn't want to go back to change all the variables. lol)
for (i=1; i <=totalQuestion; i++)
{
ID[i] = player.GetVar("Q"+i+"_ID");
Description[i] = player.GetVar("Q"+i+"_QuestionDescription");
Response[i] = player.GetVar("Q"+i+"_Response");
Result[i] = player.GetVar("Q"+i+"_Result");
Timestamp[i] = player.GetVar("Q"+i+"_Timestamp");
SCORM2004_objAPI.SetValue('cmi.interactions.'+(i-1)+'.id', ID[i]);
SCORM2004_objAPI.SetValue('cmi.interactions.'+(i-1)+'.description', Description[i]);
SCORM2004_objAPI.SetValue('cmi.interactions.'+(i-1)+'.objectives.'+(i-1)+'.id', ID[i]);
SCORM2004_objAPI.SetValue('cmi.interactions.'+(i-1)+'.type', 'fill-in');
SCORM2004_objAPI.SetValue('cmi.interactions.'+(i-1)+'.timestamp', Timestamp[i]);
SCORM2004_objAPI.SetValue('cmi.interactions.'+(i-1)+'.learner_response', Response[i]);
SCORM2004_objAPI.SetValue('cmi.interactions.'+(i-1)+'.result', Result[i]);
}
In this case, you will generate a new row for each question.