Validation

The Validation tab on the Events form is used to configure the validations that occur when posting the event. A validation can be defined for an event or an event prompt. For example, a Work Order event may have an Order Number Validation for the Order Num prompt. If the user enters an invalid order number, the validation fails and an error message appears.

You can select a predefined Standard Validation or a Custom Validation. You can also define the order in which the validations should occur and define a custom message to appear if the validation fails.

When an event or prompt validation fails, the client terminal will remain on the event prompt screen so the user can try posting the event again with different prompt values.

See Also:

Validation Field Descriptions

Find, Add, Modify, Delete, or Copy an Event or Prompt Validation

Change the Order of Event Validations (Move Up/Move Down)

Configuring the Validation Message

Overriding the Validation Message for an Event Validation

Adding Prompts and Validations to an Event when using CONFIRM in Schedule Policy

Using Prepared Statements in Queries

 

Validation Field Descriptions

Validation Type

When you add or modify an Event Validation, you must select the Validation Type.

Select Prompt Validation if the validation is for a specific event prompt.

Select Event Validation if the validation will occur before or after the event posts.

Event

Name of the event selected on the Events form, for which the validations will occur.

Prompt Name

If the Validation Type is Prompt Validation, you need to select the Prompt Name. This field displays the name of the Event Prompt for which you are defining the validation. Available options are defined on the Prompt tab for the event selected on the Events form.

If the Validation Type is Event Validation, the Prompt Name field will be disabled.

Validation Stage

Determines when the validation takes place in relation to the event or prompt.

Pre Validation: For a Prompt Validation, Pre Validation occurs before a specific event prompt appears. For an Event Validation, Pre Validation occurs before any event prompts appear.

Post Validation: The Event Validation occurs after all the event prompts have appeared. Typically, an Event Validation will be set to Post Validation.

Prompt Validation: The Prompt Validation takes place based on the user's response to an event prompt. The Prompt Stage for the event prompt determines when this validation will fire. If the prompt is Disabled, the Prompt Validation will not fire.

Refer to the table below for examples.

Validation Type

Validation Stage

Example

Event Validation

Pre Validation

The WORKORDER event has a Pre Validation called WIP Module Validation that occurs before any event prompts display. It checks to see that the WIP Module is licensed and enabled.

Event Validation

Post Validation

The PTO_REQUEST event has a Post Validation called Insert Pto Request that validates a Time Off Request and inserts records in the pto_request table based on whether the request is being added, modified, or cancelled.

Prompt Validation

Pre Validation

The F_QUANTITY_COMPLETED prompt in the WORKORDER event has a Pre Validation called Validate preprompt condition that determines whether the Quantity Complete prompt will appear.

Prompt Validation

Prompt Validation

The F_ORDER_NUM prompt in the WORKORDER event has a Prompt Validation called Order Number Validation that validates the user’s response to the Order Num prompt.

Because the Order Num prompt has a Prompt Stage of Start, this Prompt Validation will occur when the user starts the labor event.


The validations will occur in the order of their sequence numbers from the event_validation table. You can modify this order using the Move Up and Move Down arrows on the Validation tab.

Custom Validation ID

Use this field to select a custom validation for the event or prompt. Custom validations are configured on the Custom Validation form.

For an Event Validation, the custom validation must be a Query. The result of the first column in the query will indicate the success or failure of the validation. A result of zero (0) indicates success. If the result is Error Code 20201 (Validation Successful), this result will also indicate a success. Any other value for this result (including an empty record set or null value) indicates failure. The query may also include a second column with a message that will override the Validation Message. See Overriding the Validation Message for an Event Validation for more details on this configuration.

For a Prompt Validation, the custom validation can be a Static value, a List, a Query, or a Rule with the PVEValidationRuleset context. The value that the user enters for the prompt when posting the event will be verified against the custom validation.

Std Validation ID

You can select a Standard Validation for the Event or Prompt. Standard Validations are system-defined validations stored in the standard_validation table.

For example, by configuring an event with the Std Validation ID called Insert Action Process Status to Export Action record(s), the event will have an ACTION_EXPORT record on the Process Status form once it posts to the action table. Only events that can post to the action table and that have an ACTION_EXPORT record on the Process Status form can be exported in an Action export.

For information on the available Standard Validations, refer to the pve-validations.html document. This document classifies the Standard Validations as type PROMPT, EVENT, or ACTION. The PROMPT type Standard Validations can be used for Prompt Validations. The EVENT type Standard Validations can be used for Event Validations (both Pre Validation and Post Validation). The ACTION type Standard Validations can be used for Event Validations with a Post Validation stage.

Validation Message

Use this field to define a message that will be shown to the user when the validation fails. This Validation Message will be shown in addition to any default error message.

For example, the following message appears when a Prompt Validation for the Job Code prompt fails. The Validation Message is Job Code entered does not match department. The other messages (Invalid Value for Job Code and Save Failed) are the default error messages. If the Validation Message was not included in the Event Validation record, then the error would just be Invalid Value for Job Code. Save Failed. Note that the message regarding which button the user clicked (e.g., Save Failed) appears only when posting events in the web timecard.

You can include semantics and event prompt values in your Validation Message. See Configuring the Validation Message for more information.

If the validation is for an Event Validation, you can also configure an override message to display instead of or in addition to the default error message. See Overriding the Validation Message for an Event Validation for more information.

Update Date, Updated By

These fields display when the record was created or updated, and the person who created or updated the record.

 

Find, Add, Modify, Delete, or Copy an Event or Prompt Validation

To find a specific validation, use the Validation Type filter at the top of the form. Select Event Validation or Prompt Validation from this field and click Find.

To add a new validation to the event, click Add. Enter values in the fields and click Save.

To modify a validation, select it on the Validation tab and click Modify.

You can copy a validation and save the duplicate with a new name. To do so, select the validation and click Copy. Change the fields as necessary and click Save.

To delete a validation, select it on the Validation tab and click Delete.

 

Change the Order of Event Validations

The order of the validation records will determine the sequence of the validations and which ones will be applied first. The record listed on top is the first validation.

Use the Move Up and Move Down buttons on the Validation tab to change the order of the event’s validations.

To move a validation, select it on the Validation tab and click the Move Up or Move Down button until the validation is in the position you want.

 

Configuring the Validation Message

You can use the following semantics in a Validation Message to specify the person for whom the event is posting, the name of the event, and other values:

 [%GID%]

[%DID%]

[%PERSON_ID%]

[%PERSON_NUM%]

[%CREATOR_ID%]

[%EVENT_NAME%]

[%TIMESTAMP%]

[%ROUNDED_TIMESTAMP%]

[%POST_DATE%]

[%TIMEZONE%]

For example, the Validation Message is Cannot post this event for Person [%PERSON_NUM%]. The validation fails when Person 1001 posts the event, or when the person's supervisor posts it for him. The Validation Message will appear on the client as Cannot post this event for Person 1001.

You can also use the event's prompts (defined on the Prompt tab) in the Validation Message. For example, if the event has a Project number prompt (F_PROJECT), you can use [%F_PROJECT%] in the Validation Message to display the Project number the user entered. You can use the F_HOURS and F_POSTING_DATE prompts, even if they are not included in the event's prompt configuration.

If you place the following characters directly adjacent to the [% or %] of a prompt semantic, the semantic value may not display correctly:

< > _ - : /

You will need to insert a space between the above special character and the prompt semantic.

For example, if you want to display the following message:

Order and operation [%F_ORDER_NUM%]:[%F_OPERATION_NUM%] are invalid

You will need to place a space before and after the colon:

Order and operation [%F_ORDER_NUM%] : [%F_OPERATION_NUM%] are invalid

 

Overriding the Validation Message for an Event Validation

When an event or prompt validation fails, the Validation Message is prepended to the default error message.

If you are defining an Event Validation with a Custom Validation ID, you can configure the Validation Message to display without the default error message. To do so, you need to define a custom query for which the result from the first column is 2. The result of "2" indicates the Validation Message should be displayed instead of the default message. If the result is "2" and there is no Validation Message defined, then only the default message will appear.

Event Validation Query fails with result of 2. Only the Validation Message displays.

Event Validation Query fails with result of 1, null, non-integer, no result, or integer less than zero. Validation Message displays with the default error message.

 

You can also configure the Event Validation query to return an error message that will override the Validation Message and the default error message. To do so, you must configure the second column in the query to contain this override message. When this override message is configured in the query, it will override the Validation Message configured in the Event Validation record. If the result of the first query is "2" (see above), then only the override message will display. Otherwise, the override message will display with the default error message.

Event Validation Query is configured with an override message. The query fails with result of 2. Only the override message displays.

Event Validation Query is configured with an override message. The query fails with result of 1, null, non-integer, no result, or integer less than zero. Override message displays with the default error message.

 

The table below explains the configuration needed for these custom messages.

Validation Message in the Event Validation Record

Event Validation Query – Result from Column 1

Event Validation Query – Override Message in Column 2

Message That Displays to the User

No Validation Message

Result is one of the following:

1

null

non-integer

no result

integer < 0

No override message is configured

Default error message

No Validation Message

Result is one of the following:

1

null

non-integer

no result

integer < 0

Override message is "Override message from query"

"Override message from query" + default error message

No Validation Message

Result is 2

No override message is configured

Default error message

No Validation Message

Result is 2

Override message is "Override message from query"

"Override message from query"

No Validation Message

Result is integer > 2 (i.e., Error Code)

No override message is configured

Dictionary lookup of Error Code

No Validation Message

Result is integer > 2 (i.e., Error Code)

Override message is "Override message from query"

"Override message from query" + Dictionary lookup of Error Code

Validation Message is "This is the Validation Message"

Result is one of the following:

1

null

non-integer

no result

integer < 0

No override message is configured

"This is the Validation Message" + default error message

Validation Message is "This is the Validation Message"

Result is one of the following:

1

null

non-integer

no result

integer < 0

Override message is "Override message from query"

"Override message from query" + default error message

Validation Message is "This is the Validation Message"

Result is 2

No override message is configured

"This is the Validation Message"

Validation Message is "This is the Validation Message"

Result is 2

Override message is "Override message from query"

"Override message from query"

Validation Message is "This is the Validation Message"

Result is integer > 2 (i.e., Error Code)

No override message is configured

"This is the Validation Message" + Dictionary lookup of Error Code

Validation Message is "This is the Validation Message."

Result is integer > 2 (i.e., Error Code)

Override message is "Override message from query"

"Override message from query" + Dictionary lookup of Error Code