1. Home
  2. REFORMULATE directive

REFORMULATE directive

Modifies a formula or an expression to operate on a different set of data structures.

Options

OLDFORMULA = formula or expression structures Original formula or expression
NEWFORMULA = formula or expression structures New formula or expression, modified to operate on the new structures

Parameters

OLDSTRUCTURE = identifiers Data structures in the OLDFORMULA to be replaced in the NEWFORMULA
NEWSTRUCTURE = identifiers Identifier of the new data structure to replace each OLDSTRUCTURE

Description

The REFORMULATE directive allows you to modify a formula or expression to operate on a different set of data structures. The original formula or expression is specified by the OLDFORMULA option, and the new formula or expression is specified by the NEWFORMULA option. If NEWFORMULA is not specified, the new formula or expression replaces the old one in OLDFORMULA. The data structures to be replaced in OLDFORMULA are listed by the OLDSTRUCTURE parameter, and the corresponding data structures for NEWFORMULA are provided by the NEWSTRUCTURE parameter.

The example below shows how you could convert formula A*B (stored in Old) into formula Y*Z (stored in New).

FORMULA [VALUE=A*B] Old

REFORMULATE [OLDFORMULA=Old; NEWFORMULA=New]\

            OLDSTRUCTURE=A,B; NEWSTRUCTURE=Y,Z

Options: OLDFORMULA, NEWFORMULA.

Parameters: OLDSTRUCTURE, NEWSTRUCTURE.

See also

Directives: EXPRESSION, FORMULA, FARGUMENTS, FCLASSIFICATION, SET2FORMULA.

Commands for: Calculations and manipulation.

Example

" REFORMULATE example: convert formula F1 + F2 * F3
  into formula Blocks + A * B "
FORMULA     [VALUE=F1 + F2 * F3] Old
REFORMULATE [OLDFORMULA=Old; NEWFORMULA=New]\
            OLDSTRUCTURE=F1,F2,F3; NEWSTRUCTURE=Blocks,A,B
PRINT       Old,New
Updated on June 18, 2019

Was this article helpful?