You are here: > Home > Support > ToolBook Knowledge Base

Knowledge Base

SHOWING A CERTIFICATE BASED ON THE USER'S SCORE
ToolBook 9.5 shipped with a new Certificate feature. This will allow you to create a certificate page in your book to be shown to the user.

This lesson will demonstrate how to setup behavior to show the certificate only if the user received a passing score for the lesson.

OVERVIEW
In this demonstration the behavior will be as follows:

  • When the user enters the summary page the score automatically appears in a Score field, shown as a percentage.
  • When the user clicks on the Continue button, Actions Editor programming logic will take the user to one of 2 pages, depending on the score that was achieved. 
    • One page will be the certificate page
    • One page will be a message page telling them they failed

ADDING A CERTIFICATE PAGE
Using the Certificate catalog category, add a certificate page to your book and configure it as needed.

CONFIGURING THE SCORE PAGE TO DISPLAY THE CERTIFICATE

This lesson requires building the following page:

STEP 1 - ADDING A SCORE FIELD
On your summary page, add a Score field. You will find one of these in the Scoring and Tracking category of the catalog.

Configure the field as you see fit. In my case I adjusted the field so that it would center the text and use Arial 18 point Bold text. I also made it transparent and used the Inset type of border.

STEP 2 - ADDING SCORE LOGIC TO THE SCORE FIELD
In order to get ToolBook to display the score in the Score field, it is necessary to tell ToolBook to Score the quiz. Although there is a Score This Quiz button in the Scoring and Tracking category of the catalog, this demonstration will not be using that button. Instead the Score action within the Actions Editor will be used.

The goal is to have the score be shown to the user as soon as they enter the Summary page. As such we need to add logic to the On Load Page event for the Score field.

  • Open the Actions Editor for the Score field which you previously added to the summary page
  • By default the On Click event will be showing. You'll need to click on the term On Click and choose On Load Page from the choices shown to you.
  • From the Scoring and Tracking side panel in the Actions Editor add a Score Pages action.
  • To adjust the Properties of your Score Pages action, double-click the lightening bolt at the front of that newly added line within your programming window.
  • The Properties for "Score Pages" Action window will open.
  • On the General tab ensure you configure this to score All Pages In The Book.
  • On the Options tab, ensure that the Show Question Score checkbox is checked, and that the Percent Of Maximum Score is chosen. This will cause the score to be shown in this format: Score: 78%
  • Click OK to close the Properties dialog and your Actions Editor window should show the following.
  • Close the Actions Editor allowing it to save the changes.

STEP 3 - ADDING THE CONDITIONAL BRANCHING LOGIC
The Continue button is where conditional logic will be added.

  • Add a Continue button to your page. For this demonstration I used a Rounded button and modified the caption to read "continue". You can use any object you like, a button, graphic, field, etc.
  • Open the Actions Editor for the Continue button.
  • Before we start adding code, we need to create a variable to store the score in. From the Action menu in the Actions Editor, choose Define Variables.
  • Create a new Local variable with the name of myScore and set the initial value to 0.

     
    Note that you may want to define the variable as a Global variable instead. You only need to do this if you plan on using the myScore variable in other places in your book.
  • Use the Actions Editor actions to build up the following logic.
  • Notice that if the score is 90% or higher that you'll want to use a Go To navigation action, and point it to the page named "Default Certificate", which is the name of the certificate page.
  • The only line in this code which will likely look confusing is the one which says:

           set myScore to characters 8 to (charcount(text of field "Score") - 1) of
           text of field "Score"


    Although it is not necessary for you to understand how it works since it works without any modifications needed, if you are curious, here is what it is doing:

    The Score field will be holding a value such as: Score: 78%

    Although this looks great for display purposes it does us little good when what we need is just the number....the 78.

    In order to extract out just the number and leave the rest behind we need to pull-out characters (8) thru (one less than the number of characters in the string). This tosses out the % and also the "Score: ", leaving just the raw number which we can use for computational purposes.

OPENSCRIPT NOTICE
The OpenScript programming examples found in many articles may need modification in order to work in ToolBook 9.0 or higher, particularly if the article was written for an older version of ToolBook. To learn more, click here.

  Provide Anonymous Feedback About This Article