Survey Emulator Debugger


A great way to test your survey while working on the script through the designer is by using the emulator debugger.

The Emulator Debugger will allow you to add breakpoints in different parts of your script in order to pinpoint the issue with the implemented code.


There are 2 main steps in when working with the Emulator Debugger:

  1. Adding break points in your script
  2. Working with the Emulator Debugger.

Step 1: Adding breakpoints in your script

  1. Breakpoints can be added to any part of your survey that has a script:
    • Survey Init
    • Advanced Script
    • Expression Questions
    • Question\Chapter Rules - Entrance Rules, Validation Rules, Jump Rules
    • Question\Chapter Scripts - Start Script, End Script
    • Chapter Loops - Iteration Break Rules, Iteration Start Script, Iteration End Script, Iteration Entrance Rule
    • List Sources
    • Attachment Sources 
    • Survey General Jump Rule
    • Custom Actions
    • Quotas
  2.  To add a breakpoint navigate to your script and click on the gray area on the right, a red 'Ball' will appear.

Please Note: A breakpoint is added across a survey and for all users - Which means that all users working on this survey will see these breakpoints and when they'll run it in the Emulator Debugger will stop at these points.

Step 2: Working with the Emulator Debugger

  1. There are 2 options to start the Emulator Debugger:
    • Click on the Arrow next to the 'Run In Emulator' and then choose 'Debug In Emulator' 
    • Right Click on the Question in the survey you would like to start the debug from and choose 'Debug Question in Emulator'

  2. Once the Emulator Debugger will start the screen will be split to 5 smaller screens as follows:
    1. Survey Questions Display - Default UI screen that displays the questions (similar to the regular emulator)
    2. Log\Trace - The usual step by step log that will display the script logic and errors.
    3. Sources - The entire survey source code including the breakpoints added, organization scripts, advanced scripts and more. This is the screen that will help you debug your script and find any issues. 
    4. Locals\Watch - In this screen you will be able to view the expected variables\Answers and Expressions results in the different parts of your code. Please Note: Here you can type functions\variables and see what was their results e.g: Answer(QRef(1)) will return the answer etc. 
    5. Navigation Screen - Regular Question navigation pane where you can skip and return to different questions in your survey.
  3. Now that we understand the structure we can start debugging - start answering the questions using the UI display, at this time please note that the source screen buttons will be disabled until you get to the breakpoint. 
  4. Once you reach the breakpoint the different navigation buttons will become available (see that the UI Display in now disabled)
  5. Source Different Button Description
    • Continue (F5) - Executes the next Line.
    • Step Into (F11) - Executes code one statement at a time, tracing execution into function calls
    • Step Over (F10) - Executes the next line of code but does not step into any function calls
    • Step Out (Shift+F11) - Executes the remaining lines of a function in which the current execution point lies
    • Show Current Line (F6) - Lets you return to the current line that you reached. 
  6. When you reach a point in the code where there is an issue an error message will be promptPlease note: Once the message in the debugger is acknowledged the message will also appear as part of the log

  7. You can add other breakpoints within the source screen to help debug your code, they will only be saved for the current Emulator Debugger Session and will be removed once the Emulator Debugger will be closed.
  8. Searching within the Source Screen - You can use Search inside the Source screen to search for a specific code, same as in other scripts in the survey - just click on 'Ctrl+F' 
  9. Navigating to Functions within the code - F12 function is available here as well and you can use it to navigate to the function details - mark the function and click on F12.  

That's It ! 

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request



Please sign in to leave a comment.