The main objective of adding a validation rule for
a Sub-system is to allow the Virtual Column to use in the Sub-system. If there is
not any validation rule, then a record with empty validation rule for the Sub-system
must be added so that the data of the Virtual Column for the sub-system can be stored
in the database.
Important Note: All the column (not virtual column) have its default validation
rule for all the sub-system, which are setup using
Sub-system Preparation and they can be changed as required but can not be
deleted.
System uses validation rule (if available) of the column and virtual column in the
Business Rule to validate each value of the column before passing data to the data
Access layer to store into the database.
Validation Rule
This column in the FactorSubSystem table stores validation rule of a
column or
virtual column for a
Sub-system ie a
column or
virtual column can have different validation rule for different
Sub-system.
For
column or
virtual column with
string data type, the
validation rule must be
regular
expression where as for the
column
or
virtual column with
numeric data type, validation rule a range can be generated in the
Validation
Rule Setup Form.
Important Note: If there is not
any validation rule of the column
or
virtual column then this column
and
Validation Rule Error Message
can have empty (blank) for a Sub-system so that the column or virtual column
can be used with that Sub-system.
Examples:
System Column / Virtual
Column Name |
Validation Rule |
Validation Error Message |
|
State* |
^(NSW|VIC|SA|WA|TAS|NT|QLD|ACT)$ |
Invalid Australian State Code. Please enter NSW, VIC, SA, WA, NT, QLD or ACT |
|
Latitude# |
(FactorValue >= -43.0 And FactorValue <= -10.0) |
Latitude: Value expected between 10 and 43 degrees (negative means South) |
|
SiteYear^ |
(FactorValue >=1990 and FactorValue <= YEAR(TODAY())) |
A value between 1990 and Current year was expected |
|
TrialStartDate% |
(FactorValue >= '1/1/2006' And FactorValue <= Today()) |
A date between 1 Jan 1990 and Today was expected |
* For String (varchar) column, the validation rule must be in the
Regular Expression.
# Validation rule for a numeric (Integer or Decimal) column.
^ Only the limited date function can be used such as TODAY().
% System does validate any Date value between the From 01 Jan of
Start Year of the Sub-system and the current date (ie Today). So, it is NOT
recommended to add the validation rule just to validate the date that is validation
by the system itself.
Validation Rule Error Message
This column stores the message that will be displayed to the user in case the entered
value of the
column or
virtual column can not be validated by the
Validation
Rule of the Sub-system.
The following information must exist before a validation rule can be added into
the database.
- Sub-system: The sub-system for which the
validation rule of the column or virtual column is being added must exist in the
Sub-system table.
- System Column or Virtual Column:
The information of the System Column or Virtual Column must exist in the Factor
table.
To add/edit a validation rule, follow the steps below :
- Select a column record in the Column Main Form
(or virtual column record in Virtual Column Main Form).
- Use [ Record > Add Validation Rule ] or [ Record > Edit Validation Rule
] or [ Record > Repeat Validation Rule ] to load the Validation Rule
Setup Form to add/edit a Validation Rule.
- Click here
for an illustration of the setup form template.
Illustrative snapshot:
- Information of the selected column or
virtual column.
- READ THIS IMPORTANT NOTE BEFORE ADDING ANY NEW
VALIDATION RULE.
- Click it after entering Minimum Value and Maximum valuse to generate Validation
Rule (in the text box 5) of the selected Column ("Accuracy") for the Sub-system
"Wheat Agronomy".
- Sub-system for which this validation rule (or empty record) of the column / virtual
column being setup. Once a validation rule is added,
the Sub-system of the Validation rule can not be changed.
- Validation Rule of the column or virtual column for the selected Sub-system.
- Error Message that will be prompted when the value of the Column or Virtual Column
can not be validated by the validation rule.
- Note on empty/blank validation rule of the column.
When [ Save and Exit] is clicked, following dialog will prompt you to give
a chance to add the validation rule of the selected Virtual Column for all the other
Sub-system (for which the Virutal Column does not already have validation rule).
Virtual Columns are required to be excluded from one or more Sub-systems so that
data of the Virtual Column can
not be stored
for the Sub-system. The procedures are:
- [ Task > System > Manage Virtual Column and Alias ]
- Find the Virtual Column
- Select the validation rule of the Virtual Column for the
Sub-system in which you would like to exclude the Virtual
Column
- [ Record > Delete Valiation Rule ]
What will happen to the virtual columns of Genotype
when a genus can be used with many Sub-system?
Though a Genus can be used with more than one Sub-system, only the virtual columns
that have validation rule for the Current Sub-system will be displayed.
For example virtual column "Malting" has validation rule for "Barley Chemistry"
Sub-system only (but not for the "Wheat Agronomy" Sub-system). The Barley
variety can be used in "Wheat Agronomy" Sub-system. So, when the Barley variety
is displayed while the "Wheat Agronomy" Sub-system is selected, the "Malting" virtual
column will
not be displayed as the "malting"
Virtual Column does not have validation rule for the "Wheat
Agronomy" Sub-system. User has to switch to "Barley Chemistry" Sub-system to see
data of the "Malting"
Virtual Columnfor the variety.