Leverage the Latest Learning Technologies to Overcome Global Training Challenges
Share Twitter Facebook LinkedIn Google+

Calculating Score for the Quiz in Lectora Using the Modify Variable

Written By

Calculating score for the quiz in Lectora using the Modify Variable

In my earlier blog, I have talked about why Lectora is still the most powerful and flexible tool because it has flexible options in actions, conditions, and variables.

In this post, I would like to explain how to use the Modify Variable action to perform complex calculations in Lectora.

The Modify Variable action is used to create a new variable. Let’s take an example of calculating the “Score” for your learners when they attempts the questions on the quiz.

First, you need to create questions using the “Add Question” option in Lectora. Follow the steps mentioned below:

Step 1: Go to the “Test and Survey” tab, click on the “Add Question” option, and select any question type from the drop down menu.

Test and Survey

Step 2: After you create the questions, you need to create a new variable using the “Modify Variable” action as shown in image below.

Modify Variable

Step 3: Click on the “New Variable” option to create a new variable. A new variable dialogue boxes open as shown below.

New Variable

Step 4: Enter the name of variable in the “Name” (let’s take variable name as “Final_score”) field and enter its initial value as “0”.

Enter the name

Step 5: Give the action as shown in the image below to the Submit button to update the “Final_score” variable value to 1 when a learner attempts the question correctly.

Submit button

Step 6: Follow the above step for the remaining questions as well, but change the “Conditions” as per the question variable name. If your question variable name is Question_002, then you need to “Set the Action Conditions” as follows.

Variable: Question_002; Relationship: Is Correct
Variable: Question_002; Relationship: Is Not Empty

You can see the “question variable” name by double clicking on it.


Step 7: Now create a new page and name it as “Result Page”. Here you can calculate your quiz “Score” by providing the following actions.

  • First, you need to divide the “Final_score” variable by the total number of questions present in your quiz. For example, if you have 4 questions, then you need to divide the variable by 4.


  • After dividing, you need to multiply the “Final_score” variable by 100. See the image below for the Action settings.


  • To display your quiz score on the page, add a “new text block” by selecting the “Add Text Block” option from the “Insert” Tab.

Add the below action

  • After adding a text block, you need to add the below action. See the image below for reference.

Trigger: On Show
 Action: Change Contents
 Target: Final_Score_display (Your text block name)
Value: Final_score (Your variable name)

Modify Variable action

These steps help you to calculate the score for the quiz in Lectora using the Modify Variable action. I hope you have learnt something new out of my blog; please do share your comments, if any.

View Resources on Rapid E-learning Development

Topics: , ,

Subscribe to Our Blogs

Get CommLab's latest eLearning articles straight to your inbox. Enter your email address below:

eLearning Learning