Skip to main content
Kofax

How can I debug a KTM Validation Script?

11581

QAID # 11581 Published

Question / Problem:

How can I debug a KTM Validation Script?

Answer / Solution:

  1. From the menu in the KTM Validation module:
    1. Select Options ¦ Settings... ¦ Miscellaneous.
    2. Check (set) the "Allow script debugging" option.
Note: When a scripting error occurs, it will open the Script Editor on the machine where the error occurs, revealing the source code. It is not recommended that this remain enabled in a production environment, once the error is resolved.
  1. The line of code that needs to be viewed first will be highlighted in red in the Script Editor Windows.
  2. On the Script Editor Toolbar, there will be tools available such as:
    • “Browse Object”
    • “Start/Resume”
    • “Pause”
    • “End”
    • “Toggle Break”
    • “Evaluate Expression”
    • “Show Current Statement”
    • “Step Into” (Used for debugging)
    • “Step Over” (Used for debugging)
    • “Step Out” (Used for debugging)
    • “Edit UserDialog”
    • “Edit Module Properties”
  3. The additional debugging options, listed below, can be accessed by right-clicking anywhere within the Script Editor and navigating to the “Debugging” menu options.
  4. All the debugging options and their functions:
    Step Into Execute the current line. If the current line is a subroutine or function call, stop on the first line of that subroutine or function. (If the macro is not active, start it.)
    Hot Key: F8
    Step Over Execute to the next line. If the current line is a subroutine or function call, execute that subroutine of function completely.
    Hot Key: Shift+F8
    Step Out Step out of the current subroutine or function call. Hot Key: Ctrl+F8
    Step to Cursor Execute until the line the cursor is on is the current line. (If the macro is not active, start it.)
    Hot Key: F7
    Toggle Break Toggle the break point on the current line. Hot Key: F9
    Clear All Breaks Clear all break points. Hot Key: Shift+Ctrl+F9
    Quick Watch Show the value of the expression under of the cursor in the immediate window. Hot Key: Shift+F9
    Add Watch Add the expression under of the cursor in the watch window. Hot Key: Ctrl+F9
    Browse Show the methods of the expression under of the cursor.
    Set Next Set the next statement to be executed. Only statements in the current subroutine/function can be selected.
    Show Next Show the next statement to be executed.

    Using the debugging tools in collaboration with the Script documentation will assist in debugging and troubleshooting KTM Validation Script issues.
  5. One other option is to add a Message Box for particular events firing to view values/information existing at certain points during the code.
    For example:
       MsgBox "This is my Message Box"

Applies To: 

Product Version Category
AXPRO 3.1 Project Builder
AXPRO 3.1 Validation
AXPRO 3.5 Project Builder
AXPRO 3.5 Validation
AXPRO 4.0 Project Builder
AXPRO 4.0 Validation