FormDataSource.cacheAddMethod Method

Registers the specified display or edit method for caching.

public boolean cacheAddMethod(str methodName, [boolean updateOnWrite])





The name of the method to be registered for caching.


A Boolean value that determines whether the cached value is updated automatically when the record is written; optional.

true if the method was registered successfully; otherwise, false.

Cached methods perform calculations on fetched data, and then the calculated values are passed to the client together with the data. The calculated values are refreshed on reread. By default, the values are also refreshed on write and create.

This method should be called after initialization of the data source, but before any data is fetched. Therefore, the call to this method should be positioned after the call to super in the init method.

The updateOnWrite parameter also determines whether the display or edit method value should be calculated and cached when a new record is created. To manually update the cached value for the display or edit method, call the FormDataSource.cacheCalculateMethod method.

Only table methods with the display or edit keyword can be cached. Methods written on the form or the form data source cannot be cached.

Do not register display or edit methods that are not used on the form. Those methods will be calculated for each record, even though the values are never shown.

The following example registers two methods on the VendTransOpen table for caching.

public void init()

Community Additions