Share via


FormDataSource.cacheAddMethod Method

Definition

Overloads

cacheAddMethod(String, Boolean)
cacheAddMethod(String)

Registers the specified display or edit method for caching.

cacheAddMethod(String, Boolean)

public:
 virtual bool cacheAddMethod(System::String ^ _methodName, bool _updateOnWrite);
public virtual bool cacheAddMethod (string _methodName, bool _updateOnWrite);
abstract member cacheAddMethod : string * bool -> bool
override this.cacheAddMethod : string * bool -> bool
Public Overridable Function cacheAddMethod (_methodName As String, _updateOnWrite As Boolean) As Boolean

Parameters

_methodName
String

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

_updateOnWrite
Boolean

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

Returns

Applies to

cacheAddMethod(String)

Registers the specified display or edit method for caching.

public:
 virtual bool cacheAddMethod(System::String ^ text1);
public virtual bool cacheAddMethod (string text1);
abstract member cacheAddMethod : string -> bool
override this.cacheAddMethod : string -> bool
Public Overridable Function cacheAddMethod (text1 As String) As Boolean

Parameters

text1
String

Returns

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

Remarks

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 updated on reread. By default, the values are also update 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 put after the call to the super method 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 that have the display or edit keyword can be cached. Methods that are 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 are calculated for each record, even though the values are never shown.

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

public void init() 
{ 
    super(); 
    this.cacheAddMethod(tablemethodstr(VendTransOpen, 
        nextCashDiscDate)); 
    this.cacheAddMethod(tablemethodstr(VendTransOpen, 
        nextCashDiscAmount)); 
}

Applies to