Checker
Checker
:
Configuration
: Check Functions
Check Functions
Check functions are PML functions which are called by the Checker utility. The name of the function is provided to the Checker utility from the !Check.Function line in a des-checks.pmldat file.
A Check function contains PML code, which must follow these rules:
•
The function definition must have the following format:
define function !!FunctionName ( !ItemRef is DBREF, !Check is CHECKDEFINITION ) is CHKRETURN
!!FunctionName is the name of the function in the !Check.Function line in a des-checks.pmldat file. The PML file for a check function will be in a file named functionname.pml.
!ItemRef is the name of the variable containing the database reference of the item to be checked.
!Check is passed as an argument to the function, although it is not often used. !Check contains all of the information provided in the des-checks.pmldat file for this check function.
These arguments are strictly read only. The user should not reset the values of these arguments in the function itself.
•
The return information from a Check function must be put into a
ChkReturn
object. The detailed definition of this object is described later in this guide.
A ChkReturn object must be built by the Check function to tell the Checker utility whether the check has passed or failed. It is advisable to initialise the return value at the start of the Check function:
!Result = object CHKRETURN()
Declare the Return object
!Result.Passed = true
Initialise to test passed
!Result.Messages.clear()
Initialise the message list
•
The remainder of the function performs the required check on the object passed in the first argument of the Check function. If any test in the function fails, the result must be set to indicate a failure. This is done by using the following method:
!Result.Passed = false
Indicates a test failure
!Result.Messages.append(‘Text of error message’)
Add a message to the list of fail messages
The function may stop and return a result after the first error is found, or it could go on and find other errors and add them to the message list.
The result is returned to the Checker utility using the command:
return !Result
1974 to current year.
AVEVA Solutions Limited and its subsidiaries. All rights reserved.