User defined functions | Visual Basic Script |
The XpertRule run time system will report on command errors that it detects during run time execution.
Most error messages are self explanatory, with the first part of the error message detailing in which Knowledge Explorer object the error has been detected.
Command error in <object_name>
This could give the name of a Procedure type object, or an Event window (OnCapture, OnLeave, OnUpdate, etc.) that belongs to an object.
These are the most common error messages:
Unknown command
The command word cannot be found. Check the command spelling and syntax. Make sure that you are not using @Commands in a JavaScript type of procedure, or doing the reverse.
Unknown Variable
The variable name does not exist in the Knowledge Explorer, or is not defined as a temporary variable (e.g. using @DIM). Check that the variable exists and that it is spelt correctly.
Unassigned variable
Invalid value
Uninitialised parameter
Index out of bounds
These errors can be caused by any one of the following:
Unassigned usually means that the object has no initial value assigned, when you are using it in a context where a value is mandatory.
It is important to appreciate that an unassigned List Attribute is not simply a Null string. Null is not the same status that inference understands to be 'value not yet known'. Similarly, zero is not the same for a numeric attribute as 'value not yet known'. XpertRule uses its own internal mechanics to specify this very important state.
For example, if a numeric attribute called Counter was used in an Assign command like this: @Assign Counter = Counter + 1 then an error would occur if Counter has no initial value. It must have a value assigned before it can be used within the right hand side expressions of commands.
It is also good programming practice (if not essential) that variables and arrays are always initialised before calculations and string manipulations are performed using them.
See also the section on Special Boolean Expressions if you need to test this status directly and trap it.
The errors could also be caused by:
·Setting or using a value in a List that is not defined.
·Setting a variable with a value that is not suitable for the type of variable. e.g. a string to a numeric, or a real number to an integer.
·Using arrays or array ranges that do not exist.