Conditional Properties Overview

Many of the properties of the server controls can be conditioned with an indicator expression. The conditional indicators on the DDS field or constant are migrated to the VisibleCondition property of the corresponding control. The VisibleCondition property is similar to the traditional Visible property of ASPX controls in that it determines whether the control is displayed or not.

Note however, that the Visible property is of type Boolean while the VisibleCondition property is of type String. The string is interpreted as a Condition, an expression involving indicators and operators. The following are the syntax elements used by indicator expressions:

nn Test for Indicator nn
& for AND
| for OR
! for NOT
() to specify operator precedence

For example, the equivalent of the following DDS sequence:

  01   N02   03
A 04
O 05   06
O 07

Becomes this:

01 & !02 & 03 & 04 | (05 & 06) | 07

The DDS control list of conditional values are given at design time but when the record is written to the file, the list is processed from start to finish evaluating the "condition" controlling the "value." As soon as a condition is met, the associated value is used for the property. Take for example the color property. It could be assigned the color Red if indicator 17 was on, or Black if not. The state of the indicators in the AVR program at the time the record is written is used to evaluate the conditional expressions. The Monarch Web Control Indicator Expression Tester Utility can be used to test indicator expressions before changing properties and compiling and testing the application where the Display File is being used.

The use of parenthesis can specify an order of precedence in the evaluation of the expression. This is particularly useful when migrating DDS "Non display Attribute, DSPATR(ND)". Using DSPATR(ND), when the indicator expression is True, the control is NOT displayed. In AVR, the VisibleCondition evaluating True causes the control to be displayed, which is not correct in the case of the non-display attribute. Because of this, the legacy source is migrated as a negation using "!" and parenthesis around the whole indicator expression to simplify the understanding and maintenance of the migrated Display File. For example, if the above DDS sequence was applied to a non-display attribute, the migrated VisibleCondition would contain !(01 & !02 & 03 & 04 | (05 & 06) | 07).

Condition Expression

A condition is an expression involving indicators and operators as explained above. The special values *True, *False, and * None can be used in place of an indicator.

Syntax Expression
Example 03 & !99
Meaning True if *IN03 is *ON and *IN99 is *OFF; otherwise false.

Conditional Value

A Conditional Value is a value followed by a colon and then a condition. It is possible to omit either the Value or Condition, but not both. If necessary, the Value should be enclosed in quotes.

Syntax Value : Condition
Example Red: 03 & !99
Meaning The value Red is selected if *IN03 is *ON and *IN99 is *OFF

Conditional Property

A Conditional Property is an array of comma separated Conditional Values.

Syntax Conditional value, Conditional value, Conditional value...
Example Red : 03 & !99, Green : 06, Blue : 05 | 03
Meaning The value Red is selected if *IN03 is *ON and *IN99 is *OFF
otherwise, the value Green is selected if *IN06 is *ON
otherwise, the value Blue is selected if *IN05 or *IN03 are *ON

Conditional Properties

Conditional properties are utilized when specific properties are set. Classes are also provided to contain these property settings.

Property Container Class
Color ColorProperty Class
EraseFormats EraseProperty Class
ErrorMessage ErrMsgProperty Class
ErrorMessageId ErrMsgIdProperty Class
MessageId MsgIdProperty Class
SubfileMessage ErrMsgProperty Class
SubfileMessageId ErrMsgIdProperty Class

Attention Keys and Function Keys

In addition to the properties above, a special note must be made regarding AttnKeys and FuncKeys properties. These properties may be set once for the file, DdsFile.AttnKeys and DdsFile.FuncKeys, and once for the record, DdsRecord.AttnKeys and DdsRecord.FuncKeys. The keys aggregate across record formats active on the file when going to the browser.

These keys must be declared as part of each DdsFile, DdsRecord, or DdsSubfile where they are used in addition to being called by DdsButtons or similar controls.

AttnKeys and FuncKeys properties are semi-colon separated arrays representing:

       FKEY 'Text' Conditional Property 

Where FKEY is the function key, 'Text' is an optional description for the key, and Conditional Property is as described above or the special value *NONE. For instance, the following are two valid examples.

F3 'Add'; F4 'Delete'

F3 'Add' 07:!99 ; F4 'Delete' *NONE:09

Subtopic: Monarch Web Control Indicator Expression Tester Utility

Next: Monarch Framework ASPX Session Overview

Previous: Overview of AidKeys