Dump Quiz responses to a file or e-mail

New Here ,
Dec 29, 2020

Copy link to clipboard

Copied

I am using Captivate 11.5.1.499 (2019).  I have a department that wants all of their staff to take a test after being hired.  I have a good mockup of the test, and even got the SCORM to work with our LMS.

 

If the staff member fails (and honestly, even if they pass), their supervisor wants to go over the test answers with them.  I have successfully gotten the SCORM to pass the questions and answers over to the LMS, but there is no good way for the manager to see those results easily.

 

Is there a way at the end of the test (quiz) to show, or better yet, dump in a file or e-mail, the questions and answers from the test, either all of them, or at least the ones that were missed.

Views

71

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Dec 29, 2020

Copy link to clipboard

Copied

The short answer to your question is: No.

If all of the interaction data from your course module has been sent to the LMS as SCORM data then the ideal way for the manager to see the results is to view it in a report from the LMS.  But many LMSs don't give a lot of flexibility when it comes to the reports they offer.  The LMS vendor might be willing to build a custom report for you, but then they would also want to charge for that service.

 

Captivate does not provide a default way to take quiz question results and dump them to a file.  And it also does not provide any default way to send those results via an email. 

 

All of these solutions would likely be possible with custom web programming, if you have the budget to hire a professional programmer with the right set of skills.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Dec 30, 2020

Copy link to clipboard

Copied

I just realized that we're posting from the future!  I'm so glad that 2021 was better than 2020.  The giant 6 foot roaches were a surprise though...

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Dec 30, 2020

Copy link to clipboard

Copied

Your best bet is to write the information to a Google Sheet since it doesn't require server-side scripts which most LMS's won't allow.

 

I have set up scripts for a client that writes the course name, user, date, pass/fail and the respomses for each question and the attempt and highlights the cell if the response was incorrect. It does not write the question. 

 

If you format a spreadsheet the data could be pulled from Captivate and formatted accordingly in the Google Apps Script.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Dec 30, 2020

Copy link to clipboard

Copied

I'm quite familiar with writing scripts.  What I DON'T know how to do is get the data from Captivate or our LMS to a place that I COULD write it to Google Sheets, or Excel, or a text file, or anything else.

 

Any advice how to connect those things to an external file or source, like Google Sheets?

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Dec 30, 2020

Copy link to clipboard

Copied

First you need to create the Google Sheet and publish it to get an API key.

 

You need to create an external JavaScript file included in the Captivate index html file.

 

Refer to the Common JavaScript Interface:

https://helpx.adobe.com/captivate/user-guide.html/captivate/using/common-js-interface.ug.html

 

You will need to add 2 event listeners:

eventEmitterObj.addEventListener( 'CPAPI_QUESTIONSUBMIT', qSubmit, false );
eventEmitterObj.addEventListener( 'CPAPI_SLIDEENTER', checkSlide, false );

 

Create the functions qSubmit and checkSlide.

 

The check slide function in mine checks to see if the slide title is "Results" and if so, send the data to the sheet.

 

function checkSlide( e )
{
if ( e.Data.lb.toLowerCase() === 'results' )
{
if ( Number( window.cpAPIInterface.getVariableValue( 'cpQuizInfoAttempts' )) > 0 )
{
formatResults();
}
}
console.log( e.Data );
}

 

The qSubmit function gets the question number and attempt, correct answer and selected answer and puts them in an array of objects.

 

function qSubmit( e )
{
var num = Number( e.Data.questionNumber );
att = 'attempt_' + Number( e.Data.questionAttempts );
quizResults[ num ].questionNumber = Number( e.Data.questionNumber ) + 1;
quizResults[ num ].correctAnswer = e.Data.correctAnswer;
quizResults[ num ].attempt[ att ] = e.Data.selectedAnswer;
}

 

You initialize this array and objects in the moduleReadyEvent like so:

window.addEventListener( 'moduleReadyEvent', function ( e )
{
interfaceObj = e.Data;
eventEmitterObj = interfaceObj.getEventEmitter();
initializeEventListeners();

idx = cp.model.data.project_main.questions.split( ',' );
for ( var i = 0; i < idx.length; i++ )
{
var temp = { };

temp.questionNumber = 0;
temp.correctAnswer = 0;
temp.attempt = {
'attempt_1' : '',
'attempt_2' : ''
};

quizResults[ i ] = temp;
}
});

 

It can get quite complicated but the directions above can get you started with how to get and populate the information.

 

Below is how the info is sent to the sheet (Not that at the top of the file I create a case statement that checks the course name and populates a variable that has the correct API key, a seperate sheet is created for each course.)

 

The variables qa11 and qa12 and so on ar variable that get populated in a function called format results. They stand for question1 attempt 1 and question 1 attempt 2.

 

function sendResults()
{
var xhttp;

sheetURL = getKey( window.cpInfoProjectName );

console.log( 'Project Name = ' + window.cpInfoProjectName );
console.log( 'Acknowledge = ' + window.ACK );
console.log( 'Sheet Key = ' + sheetURL );
console.log( 'Quiz Results = ' + quizResults );
console.log( 'Correct Answers = ' + correctAnswers );

if ( window.XMLHttpRequest )
{
xhttp = new XMLHttpRequest();
}
else
{
xhttp = new ActiveXObject( 'Microsoft.XMLHTTP' );
}

a = window.cpInfoProjectName;
b = SCORM2004_GetStudentID();

var dt = new Date();
c = dt.toDateString() + ' ' + dt.toLocaleTimeString();

if ( window.cpQuizInfoPassFail.toString() === 'true' )
{
d = 'Pass';
}
else
{
d = 'Fail';
}


xhttp.open( 'GET', sheetURL + '?cn=' + a + '&lid=' + b + '&dt=' + c + '&att=' + quizAtt + '&pass=' + d + '&qa11=' + qa11 + '&qa12=' + qa12 + '&results=' + correctAnswers, true );

xhttp.send();

xhttp.onreadystatechange = function()
{
if ( xhttp.readyState === 4 && xhttp.status === 200 )
{
resetAttempts();
console.log(JSON.parse(xhttp.responseText));
}
};
}

 

In the Google sheet you then read in and parse the variable to populate the cells.

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more