ComponentOne True DataControl 8.0
Expression Evaluation Modes

To use True DataControl effectively, you should understand that expressions can be evaluated in one of two ways:

  1. Expressions represent simple procedures for obtaining values, and they are evaluated at appropriate times by True DataControl. For example, calculated expressions must be evaluated each time the control retrieves a record from the database. This is called synchronous evaluation, meaning that it is synchronized with some other process performed by True DataControl (in this example, retrieving data). In other words, expression evaluation takes place because True DataControl needs the result to continue with the process.

  2. Expressions also represent rules imposed in accordance with the application logic. When you formulate such rules, you delegate the task of maintaining them to True DataControl. For example, the calculated expression C = A + B states a simple rule that you expect C to be equal to A + B at all times, without having to write code to ensure this. With True DataControl, each time either A or B changes its value for any reason, True DataControl detects that the expression must change its value, too, and automatically re-evaluates it. This is called asynchronous evaluation (actually, re-evaluation). True DataControl does this automatically, without programmer’s intervention.

Synchronous evaluation is performed at well-defined times. If you are unsure when a particular expression is evaluated, see Expression Evaluation Rules.

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 it can be triggered by setting the value of a variable in code.

For some expressions, asynchronous re-evaluation has more drastic consequences than just changing a field’s value, as in a calculated expression. For example, range conditions affect the contents of the entire recordset, not just a single record. Since there is no reason to re-evaluate a range condition without re-populating the whole recordset, any change of a variable appearing in a range condition will force refresh, that is, re-populating the True DataControl recordset.

To defer asynchronous re-evaluation, (for example, to change several fields at once from code), set the ChangeInProgress property to True before updating the variables. When you are finished, set ChangeInProgress back to False to trigger the necessary re-evaluation. If you fail to reset this property to False, all asynchronous evaluations of all expressions will be permanently disabled.

 

 


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

Product Support Forum  |  Documentation Feedback