Validation scripts are used for methods verification and are created and maintained in Database Designer. They analyze diagrams and inform on whether the modelling is wrong (according to the defined criteria). Validation scripts are written in VB (Visual Basic) and you can use allp4b API functions.
The difference between conditions for link rules and validation scripts is that validation scripts analyze existing links - the conditions for link rules, can prevent the creation of the links, if the modelling was wrong.
To create validation scripts, basic programming skills are recommended.
Create Validation Scripts
- Choose the desired Unit in the Database Designer.
- Open the section “Validation Scripts” in the navigation window.
Click on the button “New”.
- Alternatively, you can use the function “New” from the context menu of the section “Validation scripts”.
A properties window appears for the newly created validation script.
The desired name for this validation script.
Unit cannot be changed in properties window as it was chosen in step 1.
- Target classes ID
Select the class(es) whose objects are to be analyzed.
- Enabled diagram classes
Select the diagram class/es where validation script will be executed.
Enables/disables the validation script.
- Validation message
Enter the text you want to be displayed in the validation window. It is displayed only when the variable “result” after running the validation script contains the value “True”.
- Validation script text
Enter here the validation script to be executed; this can be a condition (also: Conditions for Link Rules, or a small program in Visual Basic.
- Clicking “OK” creates the validation script.
Properties window of a validation script.
Examples of validation scripts
From an object of the class "input", there should always be an outgoing link.
An object of the class "input", can have no incoming links.
An object of class "Output" should have no outbound links.
|Each object of the class "activity" should have an appropriate RACI link to a role under "R".|
|An object of the class "activity" should always be linked either with another object of this class, or with an object of the class "Output".|
|Roles linked as "R" and "A" cannot have the same name, i.e., there should be different objects.|
When [Conditions for Link Rules]((conditions-for-link-rules) and/or Validation scripts have been defined, you can validate diagrams.
To do this, open a diagram and click on the validation icon (green check mark) in the process4.biz menu.
In the validation window at the bottom of the diagram appear now the messages about the successful or unsuccessful validation. These messages can be controlled by clicking on the 3 different signs:
Shows successful messages (Result = True)
Shows neutral messages and instructions (see: System dialogues)
Shows error messages (Result = False)
You can also use the search to locate the validation window for an object or a class.
When you double-click on a validation message, it or the corresponding shape/s will be marked on the diagram.
Validate a diagram.