Optimizing expressions for DataWindow and external objects

No compiler validation for container objects

When you use dot notation to refer to a DataWindow object in a DataWindow control or DataStore, the compiler does not check the validity of the expression:

dw_data.Object.column.property

Everything you specify after the Object property passes the compiler and is checked during execution. Because of runtime syntax checking, using many expressions like these can impact performance.

Establishing partial references

To improve efficiency when you refer repeatedly to the same DataWindow component object or external object, you can define a variable of the appropriate type and assign a partial reference to the variable. The script evaluates most of the reference only once and reuses it.

The datatype of a DataWindow component object is DWObject:

DWObject dwo_column
dwo_column = dw_data.Object.column
dwo_column.SlideLeft = ...
dwo_column.SlideUp = ...

Handling errors

The Error event is triggered when errors occur in evaluating DataWindow expressions. If you write a script for this event, you can catch an error before it triggers the SystemError event. This event lets you ignore an error or substitute an appropriate value. However, you must be careful to avoid setting up conditions that cause another error. You can also use try-catch blocks to handle exceptions, as described in “Exception handling in PocketBuilder”.

For information

For information about DataWindow data expressions and property expressions and DWObject variables, see the DataWindow Reference in the online Help.