Skip to main content
Kofax

Find the correct line number in a Transformation script error

3030517

Question / Problem: 

Why are line numbers in a Transformation script error message pointing to a different line than expected?

Answer / Solution: 

Though they are hidden in the Transformation Designer Script Code window, the WinWrap Basic language stores DLL references at the beginning of each class script.  Ignoring built-in references which cannot be removed, each user-added reference takes up one line.    Line numbers in the script window do not count the lines used by references, so the first visible line in the window is line 1.  Line numbers in runtime messages do count these lines used by references, thus lead to a different line in the script window.

Finding the Correct Line

  1. Go to the script of the class specified in the error message
  2. Check the number of user-added references present on this class script
  3. To get the correct line number, take the line number in the error message and subtract the number of user references.

Example

Here we intentionally raise an error from script and the number in the bottom right of the script windows shows that this is line 6, and the title of the window shows that this is the class named Northwest.

ErrorOnLine6.png

 

And in this example, the Northwest class has the following references (Edit > References).  Note that the first four are the built-in references that cannot be removed (Kofax Cascade: Project, XDoc, Image, and Collection).  And in this example we have an additional four user-added references.

ScriptReferences.png

 

When a job is run through Transformation Server, both the Transformation Server logs as well as the job notes will show the following message:

BeforeExtraction: BeforeExtract: Script execution has been stopped because of runtime error:
Northwest: Line 10, Offset 0
(99) TestError
Additional info: FireBeforeExtractXDoc

From this we can see that the class is Northwest, and the error is reported from “Line 10” even though the script does not appear to even have that many lines.  Once we subtract the four user-added references on the Northwest class, then we get the line number that we actually see in Transformation Designer: line 6.

 

Applies to:  

Product Version
KTA All
KTM All