Sample Validations

Following is a collection of a range of more complex sample validations, where the logic may not be immediately obvious.

I want to validate that you ONLY can select a certain value when a condition is met

Business Rule

Implementation

The Actual Consequence Rating of an Incident CAN ONLY be rated as Catastrophic when the Incident had

  • Environmental Consequences
  • AND resulted in Injury or Illness

Since the system does not have an operator "Only allow this value, WHEN something is true", it is necessary to employ reverse logic.

In this example, this would read:
"Validate that something IS NOT selected, when the following DOES NOT HAVE a certain Value."

Validation Builder - Example 1

I want to validate that for a NEW Incident which happened Today, the Incident Time cannot be later than the current Time

Business Rule

Implementation

When a User creates a new Incident for an Incident, which happened TODAY (on the same day the record is created), then the Incident Time cannot be later than the current time.

If the user records an Incident which happened before Today, then the system will not need to check for the Time.

This particular validation needs only to be fired under a certain condition (When the Incident Date is Today), therefore the validation is defined as follows:

Validation Builder - Example 2

In Tree Views: I want to validate that the User can only select a record which does not have any Children records

Business Rule

Implementation

When a User creates a new Incident, they must enter a Location.

The rule is that the User must only select a Location, which does not have any Child Locations - i.e. the last leaf of a node.

Validation Builder - Example 6_1

To achieve this, you will need to define that the system will throw a Validation Message, when the Relationship which represents a Child for this record has a Value.

Validation Builder - Example 6

I want to evaluate a Field on a Subform against a Field on the Parent Form.

Business Rule

Implementation

When a User creates a new Action from within an Incident, or a Safety Meeting, the system needs to verify that the Due Date of the Action cannot be before the Date the Incident was raised, or when the Safety Meeting was held.

While it is not possible to define a direct validation like:

Validate that Action Due Date is on or after Date Incident was recorded

... it is possible to achieve the same with a different approach. It requires a bit of a different Logic, but it works:

do not allow a value in the Action Due Date field, when the relevant Date Field in the Source of the Action is AFTER the Action Due Date.

You would have to create a Validation on the Action Form as follows:

Validation Builder - Example 7

PREREQUISITES:

  • to be able to create a Validation like the one above, it is necessary to represent the "WHEN" relationships as a field on the Subform. In this case, you would need to add Incident as source of Action and Safety Meeting as source of Action as hidden fields on the Action Form.
  • Make sure that the Component, upon which the Relationship is based, does have a Default Component Lookup defined.

LIMITATIONS:

  • this validation will only work AFTER the Parent record (here: Incident or Safety Meeting) has been saved prior to adding the Subform record (here: Actions).

I want to evaluate a Cross Page Validation ONLY when the user touches the Page with the validated Field.

Business Rule

Implementation

When an Incident had an Actual Consequence Rating of Catastrophic, then the Comment Field on the Sign Off Page must be filled in.

However, this validation must only occur when the user is actually entering values into the Sign Off Page.

The basic Validation is:

Validate that Sign Off Comments have a value
WHEN Actual Consequence Rating = Catastrophic.

However, since this Validation would be evaluated every time a user edits a Field on the Page which contains the Field Actual Consequence Rating, even though the record may not be ready for Sign Off yet, it will be necessary to add a 3rd field into the equation. A field which would only evaluate to TRUE when the user is actually working on the Page which contains the validated field (Sign Off Comments).

Best practice would be to add a mandatory field from this page, which would ensure that the Validation is only evaluated when required.

Validation Builder - Example 4

I want to evaluate a Cross Page Validation, even though the User hasn't touched the Page with the validated Field

Business Rule

Implementation

When an Action is raised and has a Priority of Urgent, then the User must attach a document in which the Urgency is justified.

For this to work, it is important

  • that the Page which contains the Links to Documents is visible when a new record is created.
  • that the field selected for "Validate that:" is on this "untouched" page. The validation won't work when you use a field from this "untouched" page in the "When:" section.

But other than that, this is a Validation which only needs to be triggered when a Condition is met:

Validation Builder - Example 5

See Also

Validations

How to define Validations

Creating a New Validation

How to validate a Field only WHEN a Condition is met?

Perform a Validation across several Pages

Filtering and Finding Validations in the Validation Designer