Detailed Behavior

Each instance of rate must specify the "co-ordinates" of required cell in from a rate table. The co-ordinates which uniquely identify a cell are:

Recall that each rate table can have multiple "version" with values effective from a specified date; whereas the rule object created by the Rate Rule Object Propagator has a timeline of numbers representing a varying rate value. Thus the value returned by the rate is the value of the rate cell as it varies over different versions of its rate table.

Note: If two neighboring versions of rate table contain the same value for a particular rate cell, then the timeline value for that rate cell will not change value on the rate table change data. As per Timeline semantics, contiguous identical values are amalgamated into single unchanging value.

This situation can arise where a new version of a rate table is recorded to change values in some of its rate cells only; values in other rate cells may remain unchanged.

When an instance of rate is evaluated, a rate rule object matching the required rate cells co-ordinates is sought. Ordinarily the required rate rule object will be found, and its varying rate cell value returned as a timeline of numbers.

However, if the required rate rule object has not been found (e.g. if rate propagation has not been run, for example in a unit test that creates a rate but does not publish changes), then the rate expression will create an internal rule object to hold the varying value from the rate table (subject to the same constraints that apply to the Rate Rule Object Converter - i.e. cells in sub-rows and sub-columns are not supported). If such internal rule object are created, then if a rate table change is subsequently published, then the rate expression will safely recalculate to pick up the external rule object created by the propagator. This feature means that it is possible to write unit tests that interact with rates without having to worry about rate propagation.

CAUTION:
All uses of the rate expression require a database transaction to be in effect.

For normal application processing, a database transaction will be in effect just as for other server logic.

However, for speed of testing, CER promotes the use of in-memory testing of rule sets which do not access the database. If you write any unit tests which cause a rate expression to be evaluated, then that test must run in the context of database transaction (which is in sharp contrast to the majority of unit tests for CER rule sets, which do not require a database transaction).

You must either: