Displaying a variable in the Print Results page

Dec 03, 2012

Hi, everyone.

We're collecting the learner's user ID as a text variable at the beginning of a quiz, and we'd like to display it on the Print Results page.

Does anyone know how to take a variable (i.e., TextEntry1) and add it to the reports.html page?

Thanks!

7 Replies
Joe Slawski

Thanks, Christine!

I actually found Steve Flower's examples in this post most helpful: http://community.articulate.com/forums/t/12471.aspx

For anyone interested, here's what I did:

1. Create a TextEntry field in your Storyline file. For our purposes, I created one with the variable 'TextEntry' which I used to capture our User ID.

2.  Add the Quiz slides.

3. Add a Results slide and enable 'Allow User To Print Results' (found under 'Edit Results Slide > Options').

4. Publish the Storyline file.

5. Open the folder that contains the published Storyline files and double-click on the 'story_content' folder.

6. View the 'report.html in a web page editor or Notepad.

7. Find the following code:


var g_oContentResults = window.opener.g_oContentResults;
var g_listQuizzes = window.opener.g_listQuizzes;
var g_oPrintOptions = window.opener.g_oPrintOptions;


and add the following right after the last line (bolded text is for emphasis):

var player=window.opener.GetPlayer();
var learnerID=player.GetVar("TextEntry").replace(/(\r\n|\r|\n)/g, '
');
document.write("

USER ID: "+learnerID+""); 


It should now look like this (bolded text is for emphasis):




var g_oContentResults = window.opener.g_oContentResults;
var g_listQuizzes = window.opener.g_listQuizzes;
var g_oPrintOptions = window.opener.g_oPrintOptions;
var player=window.opener.GetPlayer();
var learnerID=player.GetVar("TextEntry").replace(/(\r\n|\r|\n)/g, '
');
document.write("

USER ID: "+learnerID+""); 

 As you can see (bolded text), I created a unique Javascript name learnerID and added the Storyline variable TextEntry. You can update both of these to reflect your project, but just make sure that the Javascript name is updated in both bolded places above.



The USER ID: is my label for the collected information. You can change this to whatever you want, and it's not case-sensitive.



IMPORTANT: If you publish your Storyline file again, it will overwrite this report.html file, so make sure you make a back up and copy it to the 'story_content' folder.


 

9. Save the 'report.html' (overwrite the existing copy).


10. View your published Storyline file and then click the 'Print Results' button. The information you captured now appears at the top of the 'Print Results' page.



You can experiment with the placement of the text on the 'Print Results' page. I've also added a print button to mine (due to our requirements).



I hope this helps
 


This discussion is closed. You can start a new discussion or contact Articulate Support.