Share via


FormDataSource.cacheCalculateMethod Method

Calls the specified cached method and updates the value in the cache for the current record.

Syntax

public boolean cacheCalculateMethod(str methodName)

Run On

Client

Parameters

  • methodName
    Type: str
    The name of the table method to call.

Return Value

Type: boolean
true if the value has been updated; otherwise, false.

Remarks

The cached value is updated only if the method name that was supplied was previously registered as a cached method by using the FormDataSource.cacheAddMethod method.

The cacheCalculate method is particularly useful if you want to update cached values only when certain conditions are met. In this case, set the updateOnWrite parameter in the call to the FormDataSource.cacheAddMethod method to false, and then manually update the cache, such as by using the write method on the data source.

Examples

The following example recalculates cached values by using the nextCashDiscDate method and the nextCashDiscAmount method, both of the VendTransOpen table.

public void write() 
{ 
    super(); 
    vendTransOpen_ds.cacheCalculateMethod(tablemethodstr( 
        VendTransOpen, nextCashDiscDate)); 
    vendTransOpen_ds.cacheCalculateMethod(tablemethodstr( 
        VendTransOpen, nextCashDiscAmount)); 
}

See Also

FormDataSource Class

FormDataSource.cacheAddMethod Method

FormDataSource.write Method