Home |Using Katmandoo | Quick Start Guide | How-to | Task Menu | Table of Contents | See Also | Collapse All

Virtual Column (and System Column) Validation Rule

Overview

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.

Detail

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.

Table Structure

Column Name Description
FactorSubSystemId (PK) Identification Number to uniquely identify a column or virtual column Sub-system record
FactorId (AK1) column or virtual column for which the validation rule is defined
SubSystemId (AK1) Sub-system for which the validation rule of the column or virtual column is defined
Validation Rule Validation rule of the column or virtual column for the Sub-system
Validation (rule) Error Message The error message that will be displayed in case the data of the column or virtual column can be validated using the validation rule.

Pre-requisite

The following information must exist before a validation rule can be added into the database.

Setup Form

To add/edit a validation rule, follow the steps below :
Illustrative snapshot:
Setup Form of Validation Rule of selected Virtual Column (Click it to change its size)
  1. Information of the selected column or virtual column.
  2. READ THIS IMPORTANT NOTE BEFORE ADDING ANY NEW VALIDATION RULE.
  3. 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". 
  4. 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.
  5. Validation Rule of the column or virtual column for the selected Sub-system.
  6. Error Message that will be prompted when the value of the Column or Virtual Column can not be validated by the validation rule.
  7. 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).
Setup Form of Validation Rule of selected Virtual Column for All Sub-systems

How to exclude a virtual column from a Sub-system?

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:
  1. [ Task > System > Manage Virtual Column and Alias ]
  2. Find the Virtual Column
  3. Select the validation rule of the Virtual Column for the Sub-system in which you would like to exclude the Virtual Column
  4. [ 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.

See Also