Workflow - Conditions

This section deals how workflow criteria, also called conditions, operate. (See Workflow Overview for information of setting up workflows).

All of the files you place into Database Monitor may have workflows attached and there is no theoretical limit to the number of workflows that may be created. Each workflow operates independently of every other one, meaning that if you have 10 workflows on a file it is conceivable that all 10 will get activated by a file change.

Within each workflow are created what are called "criteria". There are two types of criteria:

  • Record-Level
  • Field-level

Record-level criteria

Record-level criteria are based on the type of change occurring to the database record, regardless of the field values involved. For instance, if you want a workflow to activate only when a record is deleted, then you would add a record-level criteria of "Record Deleted" to the workflow. Below are the record-level conditions which you may use:

CH = Any Change

Causes the workflow to activate when any field on the record changes. Note that added records and deleted records are considered applicable to this condition. So, if a record is added, deleted, or has at least one of its field values (any one) changed, the CH criteria will be met.

AR = Add Record

This condition is only met when a database record is added to the file. Some workflows are only concerned with a certain value in a record when it first appears. For instance, when a customer is created, someone in Accounts Receivable may want to be notified. In this case, you would use an AR condition.

CR = Change Record

Change Record conditions cause the workflow to fire only when the type of activity is a record update. This will specifically exclude Adds and Deletes of records, unlike the CH (Any Change) criterion above.

DR = Delete Record

Is only true when a record is physically deleted from the file.

Field-level criteria

Field-level changes have to do with individual fields (also called columns) in a file. When we are only concerned with activity that affects a particular field in a file, we use field-level criteria on its workflows. These criteria allow you to monitor for "changed to" or "new" or "deleted" values by testing for the actual contents of the field. The contents checked may refer to the "before" value or the "after" value. The valid field-level criteria are as follows:

CH = Any Change to the field's value

This is a basic criterion that states that if the field in question is changed from any value to any different value the workflow is activated. Note that this condition only evaluates to true during a record change, not during adding or deleting records.

EQ = Only activate when field is equal to a given value

With the EQ condition, you are presented with a field into which you enter a comparison value. If the "before" value is specified and the value of the field before the change equals this value (or the "after" value is specified and the "changed to" value is equal to the comparison value, the workflow will be activated (assuming it passes all other criteria).

NE = Only activate when field is not equal to a given value

This is just the opposite, of course, to the EQ condition. When a field's before or after value does not match the value input, this condition is met.

GT = Only activate when field is greater than a given value

Here, the field's value (before or after) is compared with the comparison value entered on the criterion. If the field's actual value is greater than (either quantitatively, in the case of numeric fields, or alphabetically, for character fields), then the condition is qualified.

LT = Only activate when field is less than a given value

The same as GT, except that the field's value must be less than that of the comparison value.

GE = Only activate when field is greater than or equal to a given value

The same as GT, except that if the field's value is exactly equal to that of the comparison value the condition is met.

LE = Only activate when field is less than or equal to a given value

The same as LT, except that if the field's value is exactly equal to that of the comparison value the condition is met.

IP = Only activate when field is increased by a given percentage

This condition only applies to numeric type fields. Here, the "before" value of the field is compared with the new value of the field. If the new value is greater than or equal to the old value increased by the percentage indicated in the comparison value field, then the condition qualifies. Specifically, if newvalue >= oldvalue * (1 + comp/100), where comp = comparison value, then the condition is met.

DP = Only activate when field is decreased by a given percentage

This condition only applies to numeric type fields. Here, the "before" value of the field is compared with the new value of the field. If the new value is less than or equal to the old value decreased by the percentage indicated in the comparison value field, then the condition qualifies. Specifically, if newvalue <= oldvalue - (oldvalue * (comp/100)), where comp = comparison value, then the condition is met

IV = Only activate when field is increased by a given value

This condition is the same as IP (increase by percentage) except an actual value is used for the comparison. Specifically, if newvalue >= oldvalue + comp, then the condition is met.

DV = Only activate when field is decreased by a given value

This condition is the same as DP (decrease by percentage) except an actual value is used for the comparison. Specifically, if newvalue <= oldvalue - comp, then the condition is met.

Multiple criteria in one workflow

A combination of "AND" and "OR" relationships can be used to manage the activation of a WorkFlow. Every time an "OR" is encountered a new set of criteria is being considered.

In the example below, three combinations are possible:

Combination 1

Lot's status (LOSTAT) before change was Q

AND

Lot's status after the change is an A

Combination 2

Lot's status (LOSTAT) before change was Q

AND

Lot's status after the change is an R

Combination 3

Lot is deleted from the file.