Search
Search

The REC Statement provides a convenient method to create and manipulate the values of new records using Script Logic.  The basic format of the REC statement is as follows:

…

*WHEN Dim1

*IS *

*REC(FACTOR=1, Dim2=”A”)

*ENDWHEN

…

NOTE: The REC statement requires the selection of an existing record to process, hence the mandatory inclusion of the WHEN / ENDWHEN statements.

The new record(s) created by the REC statement inherits the same values of all dimensions from the original record.  Any dimension specified within the REC expression will override the original dimension value and will be substituted by the REC definition for that dimension.  In the example above, the REC statement inherits each record’s dimension values except for Dim2.  Regardless of the original record’s Dim2 value, the new record will have Dim2 set to the value “A”.

The REC can accept multiple dimension assignments, each dimension assignment must be separated with a comma.  Example:

…

*REC(FACTOR=1, Dim2=”A”,Dim3=”C”,Dim4=”D”)

…

The keyword FACTOR allows the definition of a numeric value that is used to determine the new record’s value. Factors are multiplied against the original record’s values.  In the example provided, a FACTOR=1 essentially keeps the original value in the new records being created.  A FACTOR=2 will double the value of the new record, and a FACTOR=0.5 will reduce the new record’s value by half.   Example:

*WHEN ….

*IS ….

*REC(FACTOR=.5)

*ENDWHEN

A FACTOR can be positive or negative values:

…

*REC(FACTOR=-2)

…

A FACTOR can contain simple calculated values:

…

*REC(FACTOR=3.6/4.7)

…

In this case, the factor that will be applied is 3.6 divided by 4.7 or 0.765957.

The keyword EXPRESSION may also be used to modify the REC generated record values. The EXPRESSION formula can include regular arithmetic operators, fixed values and the keyword %VALUE% (representing the original retrieved value).

Examples:

…

*REC(EXPRESSION=%VALUE%+1500)

…

In this example, the value of the new record is determined by adding the value of the original record (%VALUE%) by a fixed amount (1500).

To report this post you need to login first.