Home Search

DriveWorks Pro 21
Concept: Use of the Override Rule (KB12121001)

Send Feedback

Introduction

The override rule is useful in restoring default values or forcing calculated values into a control. This can greatly enhance the specification experience by simplifying choices or entries the user has to make. Some form controls have the ability to force a value into the control that will override any entry or selection made by the user. The chart below lists the controls that have this dynamic property available:

Control TypeOverride Rule property name
Check BoxChecked (Override Rule)
Combo BoxSelected Item (Override Rule)
List BoxSelected Item (Override Rule)
Option GroupSelected Item (Override Rule)
Spin ButtonValue (Override Rule)
Text BoxText (Override Rule)

Using the Override Rule

When forcing a value into the control using the Override Rule property it is important to understand that the result of the Override rule takes priority over what is actually displayed in the control.

For example a check box has it's override rule to be:

IF ( MyOptionsReturn = "Type A" , TRUE , MyCheckBox )

Where MyOptionsReturn is a combo box from which "Type A" can be selected

True is the result forced into the check box control when "Type A" is selected

MyCheckBox is the name of the check box the override rule is being applied to.

When using form control values in a rule the Return value of the control is used; i.e. the control name is displayed as MyControlNameReturn in the rule. When using the override rule however, only the actual name of the control should be used; i.e. MyControlName. See the How to select the Control Name in the Rule Builder section below.

The rule above will force the value of the check box to equal True (checked) when the selection in the control MyOptions equals Type A.

The check box can be de-selected (unchecked) while the value in the control MyOptions equals Type A, but the value DriveWorks will always use is the result of the override rule. To prevent the control from displaying information that is contradictory to the result of the override rule please refer to the  Considerations when using the Override Rule section below.

Check Box

Override rule must result in True or False. It must also conform to any form messages that could be displayed by the Error Result property.

Combo Box

Override rule must result in an item that can be selected from the combo box. It must also conform to any form messages that could be displayed by the Error Result property.

List Box

Override rule must result in an item that can be selected from the list box. It must also conform to any form messages that could be displayed by the Error Result property.

Option Group

Override rule must result in an item that can be selected from the option group. It must also conform to any form messages that could be displayed by the Error Result property.

Spin Button

Override rule must result in a number that falls in between the minimum and maximum property values set for the control. It must also conform to any form messages that could be displayed by the Error Result property.

Text Box

Override rule must result in text or a number that conforms to any form messages that could be displayed by the Error Result property.

How to select the Control Name in the Rule Builder

To select just the control name and not its Return value, from the Rule Builder:

  • Highlight the control from the forms tab of the Rule Builder.
  • Double Click the Name property from the Control Properties section directly below the list of form controls.
  • The Control Name will appear in the position of the cursor in the rule editor or, if a function wizard is open, in the position of the cursor in the function wizard.

Considerations when using the Override Rule

Preventing the selection of controls when the override rule is in operation

It is highly recommended that when using the override rule the Enabled property is set to False (disable). This will force the user into entering different information into the control that has invoked the override value.

For example a check box has it's override rule to be:

IF ( MyOptionsReturn = "Type A" , TRUE , MyCheckBox )

It should also have the following rule for the Enabled property:

IF ( MyOptionsReturn = "Type A" , FALSE , TRUE )

Now when the control MyOptions equals "Type A" the check box will be checked (TRUE), but it will also be disabled (FALSE), preventing the user from un-checking the check box.


Knowledge Base Article Ref:KB12121001