How to debug a KTM Validation Script during runtime?
The following text refers to all KTM interactive modules like KTM Correction, Validation and Verification.
Debugging in thin client is not possible. Here you can log data to files.
Showing the Script Window
To show the scripting window in KTM Validation module:
- Go to the menu and select Options > Settings... > Miscellaneous
- Check (set) the "Allow script debugging" option.
If this option is grayed out then you need to suspend the batch, go to KC Administration, select the batch class, do a right click to show the popup menu, select the extended synchronization settings > sheet Validation > Allow script debugging. Close window, publish batch class, run batch manager, select your suspended batch, do a right click and select "update batch class".
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 remains enabled in a production environment, once the error is resolved.
On the Script Editor Toolbar, there will be tools available such as:
- “Browse Object”
- “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”
All the debugging options and their functions
The additional debugging options, listed below, can be accessed by right-clicking anywhere within the Script Editor and navigating to the “Debugging” menu options.
|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.
Using message boxes
One other option is to add a Message Box for particular events firing to view values/information existing at certain points during the code.
MsgBox("This is my Message Box")
Keep in mind, that message boxes are not allowed in thin client modules.
If you have changed something then these changes will be lost after you have closed the batch. If you want to keep it in the project then you you will not find any save option in the window. To keep the changes you need to apply the code changes in the project in Project Builder and publish it afterwards.
Level of Complexity
|Kofax Transformation Module||all|
Add any references to other internal or external articles
Article # 3035588