Free Demo
1.866.696.8709
Atrixware » Blog Archive Modifying Question Prefixes in Test Pro Developer - Atrixware
learning management system
Axis LMS
Ready to Enhance and Streamline YOUR Training?
Works on Windows, MacOS, iPad, iPhone & Android
FREE DEMO

Modifying Question Prefixes in Test Pro Developer

In this article, I will show you how to work with the question prefix setting for questions inside of Test Pro Developer. In my example, I will show you how to display each questions category above each question.

This is definately a more technical article than most, so I will attempt to describe everything as best I can.

Start by launching Test Pro Developer:

Step 1: Click on your Develop Tests tab and select the test that you would like to modify.
Step 2: Click the Tools button and select “View/Edit Test Level Powerscript

bselect_ps.jpg

Step 3: Once the code window is opened, copy and paste this code snippet: (Note: If you have code in this window already, it will be best to paste it below all existing code).

Sub OnShowQuestion
 qPrefix = "<strong><% Question.GetCategory(Question.GetCurrentNumber ) %></strong>"
 qPrefix = qPrefix & vbcrlf & vbcrlf & "<% Question.GetCurrentNumber %>. "
 Interface.Question_Prefix = qPrefix
End Sub

bpaste_code.jpg

Understanding the code

Sub OnShowQuestion/End Sub: These lines define the block of code that will execute when a question is shown. All code inside these two lines will execute prior to each question getting displayed – providing us with the opportunity to create the prefix each time.

qPrefix = : These two lines (starting with qPrefix =) are building our prefix. In this case the prefix consists of both dynamic and static text and content:

  • <strong></strong> tags surround the text we want to appear in bold (in my example, I have bolded the category).
  • “<% Question.GetCategory(Question.GetCurrentNumber) %>” represents the question category. Since each question may be in a different category, we get the category of the active question using the code above. The <% %> tags are a special case only used in this scenario – it’s too much to explain in this short article, but the important thing to know is that when assigning dynamic data to the question prefix, all dynamic data gets placed into quotes surrounded by these tags.
  • “<% Question.GetCategory(Question.GetCurrentNumber) %>” represents the question number itself (1, 2,3, etc). Since we are changing the default question prefix (which is just the question number by default), if we still want the question number to appear, we need to include it in our code. Again, the <% %> tags are used since the question number is dynamic (each question has a different number).
  • You see various & (ampersands) in the code. These simply concatenate all of the sections in quotes, and sections not in quotes, together as we build the prefix. If your entire prefix was in quotes, then we would not need to use these.
  • You see various vbCrLf text in the code – these represent a line feed + carriage return (in my example, to get the category on one line, and then the question 2 lines below that, I added to vbCrLf’s after the category to achieve the result).

Interface.Question_Prefix = : this is the line of code that assigns our prefix to the question.

Step 4: Click your preview button in your code editor to see the changes that you have made

bpreview.jpg

btest.jpg

Step 5: Click Save and close your code editor

bsave.jpg

If you enjoyed this article please consider staying updated via RSS.

Comments are closed.

A Better, Easier & Less Expensive Learning Management System
Try the Atrixware Axis LMS