Lectora Basics: About Question Variables

Lectora Basics - About Question Variables

Quite often, we get questions from our Lectora® users wondering how they can provide some kind of customized behavior based on a learner’s response to a question, such as showing a checkmark or an X next to each option of a drag and drop or matching question. And most often, the answer involves querying the contents of the question object’s associated variable. Every time you create a question object, an associated reserved variable is automatically created. You can see these on the Properties ribbon for the question and on the Reserved tab of the Variable Manager.

question window

reserved variables

But how can you tell what is inside of those variables at any given time? The easiest way to see the contents of a variable is to run the page containing the question in Debug Mode. You will find this on the View ribbon.

When you run a page in Debug Mode, an external pop-up window appears that tells you what is happening behind the scenes. The Debug window will display every READ and every SAVE that happens with the variables on the current page, and also shows the current value of those variables within [brackets].

debug window

The initial value for all question types is null or empty, meaning the learner has not yet attempted to answer the question. But once the learner has interacted with the question, the value of its associated variable will change. The format of the value varies by question type. The table below explains the formats for the 12 different question types available in Lectora.

Question Type Variable Value Example
True or False The contents of the text field associated with the radio button that was clicked True
Multiple Choice – text options only The contents of the text field associated with the radio button that was clicked Choice One
Multiple Choice – image options only The name of the image as shown in the Title Explorer that is associated with the radio button that was clicked. By default, the images are named “Choice 1 image,” “Choice 2 image,” etc. But you can rename them. Choice 1 Image
Multiple Choice – both text and image options The contents of the text field associated with the radio button that was clicked. With a mix of options, image only options will be substituted with a text string representing the option number. Choice Three
Multiple Response – text options only The contents of all of the text fields associated with the check boxes that were checked, separated by commas Choice One,Choice Two,Choice Three,Choice Four
Multiple Response – image options only The names of the images as shown in the Title Explorer that are associated with the check boxes that were checked. By default, the images are named “Choice 1 image,” “Choice 2 image,” etc. But you can rename them. Choice 1 image,Choice 2 image, Choice 3 image
Multiple Response – both text and image options The contents of all of the text fields associated with the check boxes that were checked, or the names of the associated images as shown in the Title Explorer. By default, the images are named “Choice 1 image,” “Choice 2 image,” etc. But you can rename them. Choice 1,Choice two,Choice 3 image
Fill in the Blank The current contents of the text entry field. This changes every time the user types a character. My answer
Number Entry The current contents of the text entry field. This changes every time the user types a number. 1234
Matching The names of all of the Left and Right pairs that have been matched, separated by commas. The name for each pair component is up to you. You can rename these in the Question Creator. The default values would look something like this example. 1L-3R,2L-1R,3L-2R
Rank and Sequence The contents of all of the text fields associated with each drop list for which a selection has been made, separated by commas. Choice One,Choice Two,Choice Three,Choice Four
Drag and Drop All of the Item Names paired with the Drop Zone Names they have been matched with. The Item Names and Drop Zone Names can be changed by you. By default, they are simply numbered 1, 2, 3, etc. If an Item Name has not yet been paired with a Drop Zone, the drop zone part of the pair is represented as (na) in the variable. See example. 1-1,2-3,3-(na)
Hot Spot The name or names of the hot spots that have been clicked, separated by commas .You can rename the hotspots. By default they are numbered 1, 2, 3, etc. A Hot Spot question can behave like a Multiple Choice question or a Multiple Response question if the “Correct Answer Includes More Than One Choice” option is checked. 1,2,3,4
Short Answer (Ungraded) The current contents of the text entry field. This changes every time the user types a character. My short answer
Essay (Ungraded) The current contents of the text entry field.  This changes every time the user types a character. This is my essay.
Likert (Ungraded) The contents of the text field associated with the radio button that was clicked Agree

 

Now that you know what to expect to find inside of the question variables and how to see the contents of them for yourself running under Debug Mode, you can set up actions with conditions that query the contents of a question’s variable to trigger some desired behavior. In the example below, the action is set up to show a check mark if Question_0002 contains 1L-1R for an option of a Matching question if the condition is true. If the condition is false, the action shows an X instead.

action window