Numerical or textual values used in conditions can be defined as constants. For example, in a glucose Knowledge Base you might define a constant Very_High_Glucose= 11.1. Then, instead of “hard-coding” numbers into your rules like “glucose > 11.1” you can use the constants, e.g. “glucose > Very_High_Glucose“.

Using constants rather than hard-coded numbers is strongly recommended. The advantages are:

  • A constant such as Very_High_Glucose is more understandable than the number “11.1”, especially for someone who is exploring the Knowledge Base.
  • Once you have defined a constant, you can change its value at a later stage if required. This means that any conditions that use that constant will not have to be changed, saving you a lot of time.

Constants are defined and modified using the Constants Editor, which is launched from the Knowledge Builder from the ‘Edit’ menu.

Each constant consists of a name and a value. Multiple constants can be defined and will appear listed in a table:

3 const  7.3

The table can be sorted either by name or value simply by clicking on the heading.

To use constants:

Constants can be used by typing the constant name into expressions, for example:

Glucose > Very_High_Glucose

Note: The constant name must be typed and it cannot be selected from the tabs in the rule wizard.

Updating and existing Knowledge Base to use constants

Once you have defined a set of constants, you can update the existing conditions in your knowledge base to use these constants. Use the ‘Update conditions’ button. The system will then find all the conditions that use one of the constant values you have defined. You will then be asked to confirm each condition before the replacement is made, as shown in the example below in which the value 11.1 will be replaced with the newly defined constant called Very_High_Glucose:

1 Const 7.3