ComponentOne True DataControl 8.0
Expression Evaluation Rules

As described in the section Expression scope levels, each type of True Date expression is evaluated in one of two contexts:

Record level

Occurs when a TData control is in the process of retrieving a record from the database, or has already positioned to a specific record. At evaluation time, all fields have definite values; therefore, all variables (parameters and fields) of the control and its ancestors (in master-detail relationship) can participate in the expression.

Recordset level

Occurs when a TData control is in the process of populating the recordset, in which case the set of records is still undetermined and the control is not positioned on any particular record. Since field values are undefined at evaluation time, the expression cannot use any fields defined for the control; it can only contain constants (numbers or strings), parameters, and any variables (including fields) of ancestor TData controls (if in master-detail relationship).

As described in the section Expression evaluation modes, the evaluation of a True DataControl expression is said to be synchronous or asynchronous, depending on how it was triggered:

Synchronous

Synchronous evaluation is triggered by some other process performed by True DataControl, such as data retrieval. The expression must be evaluated because True DataControl needs the result to continue with the process.

Asynchronous

Asynchronous evaluation is always triggered by a change in the value of a variable appearing in the expression. This can be caused by end-user interaction with a bound control, or by setting the value of a variable in code.

For each type of True DataControl expression, the following tables show the corresponding scope level, synchronous evaluation criteria, and consequences of asynchronous evaluation.

TABLE 1

Constraint.ConstraintExpression (for record-level constraints, in the collection returned by the Constraints property)

For record-level constraints, specifies a Boolean expression that determines the validity of a modified record before it is updated to the underlying data source. If the constraint expression evaluates to True, the modified record is updated; if the constraint expression evaluates to False, no update will occur and the user will be notified of the constraint violation according to the MessageExpression property. "_Toc406812094">

Level

Record level.

Synchronous

Evaluated before the modified record is posted to the database, or before the TData control is repositioned to a different record.

Asynchronous

No action.

TABLE 2

Constraint.ConstraintExpression (for field-level constraints, in the Field.Constraints collection)

For field-level constraints, specifies a Boolean expression that determines the validity of a modified field. If the constraint expression evaluates to False, field modification will be canceled and the user will be notified of the constraint violation according to the MessageExpression property.

Level

Record level.

Synchronous

Evaluated before the field is modified.

Asynchronous

No action.

TABLE 3

Constraint.MessageExpression (both for field-level and record-level constraints)

Specifies a string expression that determines the error message to be displayed when a constraint violation occurs. If you leave this property blank, True DataControl displays a generic "Constraint violation" message.

Level

Record level.

Synchronous

Evaluated before the Error event is fired.

Asynchronous\

No action.

TABLE 4

Field.CalculatedExpression

Specifies the expression used to calculate the field's value. It is normally used for calculated fields, but data fields can also have calculated expressions, in which case the field's value changes whenever one of the fields referenced in the expression changes.

Level

Record level.

Synchronous

Evaluated after a record has been fetched from the database.

Asynchronous

Updates the value of the associated field.

TABLE 5

Field.DefaultExpression

Specifies the default value to be assigned to the field in a newly added record.

Level

Recordset level.

Synchronous

Evaluated after a new record has been added to the recordset.

Asynchronous

No action.

TABLE 6

FilterExpression.FilterExpression

Specifies a Boolean expression that will be evaluated once per record to filter the recordset. If all filter expression evaluate to True, the record will be included; if a filter expression evaluates to False, the record will be excluded.

Level

Record level.

Synchronous

Evaluated after a record has been fetched from the database and all calculated expressions have been evaluated.

Asynchronous

Action depends on the variable whose change triggers asynchronous evaluation. It forces refresh of the TData control unless the changed variable is a field (not a parameter) belonging to this control. Changes to parameters or ancestor fields force refresh.

TABLE 7

Parameter.ValueExpression

Defines the expression used to assign a value to the parameter.

Level

Recordset level.

Synchronous

Evaluated before the recordset is populated with records.

Asynchronous

Action depends on whether or not the parameter is used in an expression forcing refresh. If so, changing its value forces refresh.

TABLE 8

PropertyExpression.ValueExpression

Specifies an expression that provides a value for the associated property at run time. The property belongs to a control residing in the same form as the TData control. "_Toc406812094">

Level

Record level.

Synchronous

Evaluated when the TData control has been positioned on a record.

Asynchronous

Updates the value of the associated control property.

TABLE 9

RangeCondition.

Specifies the operand to be used for comparison. The resulting range condition is field op value, where field is the data field that owns the range condition, op is the comparison operator, and value is the result of this expression.

Level

Recordset level.

Synchronous

Evaluated before the recordset is populated with records.

Asynchronous

Forces refresh of the TData control.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback