new to Analytica 5.0
InvalidateResult( x )
Invalidates the cached computed result for variable «x», and all down-stream cached computed values that depend on «x». This clears both the Mid-value and Sample-value of «x».
This function can only be used from an OnClick on OnChange event, or from Typescript. In can be used in a User-Defined Function that is called from OnClick or OnChange. It cannot be evaluated while a variable evaluation is in progress since clearing a cached value is a side-effect.
An example usage of this function is to invalidate data that was previously imported from an external source, forcing the model to re-read updated data from that data source. To do this, create a button and have its OnClick attribute call
InvalidateResult( x ), where
x is the variable that reads in the data.
This function was introduced in Analytica 5.0, so it is not available for use in Analytica 4.6 or earlier. Prior to the introduction of this function, the equivalent was accomplished by adding a variable named
Reset to the model, and creating an artificial dependency on Reset in each variable that you wanted to invalidate. The artificial dependency is introduced by changing the definition of «x» to
Reset ; «previous definition of x». Then the button's OnClick would be
Reset := Reset + 1. When reset changes, its downstream variables are invalidated. With this function, you can invalidate «x» directly.
Enable comment auto-refresher