Developing Longview Models
This chapter contains information on these main topics:
Creating Model documents
A Model document in Longview Application Framework contains calculation rules for your Longview system to create or change data. It modifies the data by calculating the value of symbols according to rules you specify. Your Longview system can then use the calculated data in Reports and other documents.
Note: To add a comment to syntax, insert two forward slashes ( // ) at the beginning of the comment.
A Model document can run any calculation, including financial functions such as Net Present Value (NPV), and conditional or simultaneous (recursive or circular) equations.
A Model document can only perform calculations on a single DataArea, although it can use values from different DataAreas as a source for the calculations.
Use a Model document to:
- perform calculations
- run the same calculations for data stored in several DataAreas
- provide more flexibility in specifying calculation types when you need to perform calculations in non-standard order.
Parts of a Model document
A Model document must contain the following types of function statements within the document body
Statement | Description |
---|---|
CalculationBlock statement | Applies subsequent calculations to symbols in a specified dimension only. |
Calculation statement | Specifies the required calculations. |
The CalculationBlock function is used to define the DataArea to which subsequent calculations are applied. A CalculationBlock statement stays in effect until the End CalculationBlock is executed. All calculation statements that pertain to the symbols specified within the CalculationBlock statement must appear after the CalculationBlock and before the End CalculationBlock statements.
The CalculationBlock statement parameters define the symbol ranges for all dimensions to limit or restrict the calculated DataArea.
The calculated dimension determines the symbols used for the subsequent calculation statements.
CalculationBlock (CalcDim[;RestrictedDim SymName
[Structure][,SymName[Structure]]][;RestrictedDim SymName
[Structure][,SymName[Structure]]])
End CalculationBlock
where:
- CalcDim defines the dimension that will be used in the calculation statements.
- RestrictedDim is a dimension that will define a limited or restricted calculated DataArea.
- SymName refers to the symbol name that will define a limited or restricted calculated DataArea.
Note: To specify a range of symbols to limit the calculation to, enter the first and last symbols in the range, separated by a colon. For example, A0601:A0612.
- [Structure] is optional and is the symbol structure that will define a limited or restricted set of symbols.
Sample Model document
This example illustrates a Model document named ForCpy.lvmod. This Model document defines several calculation blocks and calculation statements.
The following command is executed in a Procedure document:
The following is executed in the ForCpy.lvmod Model document:
Sample Model Document
// Model sample document comment
CalculationBlock (TIMEPER; ACCOUNTS BALSHEET#99; ENTITIES W11110#99; DETAILS P1000#99)
A31120=0
End CalculationBlock
CalculationBlock (ACCOUNTS; CURRENCY CCAD)
TRANSFER COMMON,A0701,COMMON,COMMON,CCAD,DIM5SET TO COMMON,F0702,COMMON,COMMON,CCAD,DIM5SET FROM "ACTDATA"
End CalculationBlock
CalculationBlock (TIMEPER; ACCOUNTS BALSHEET#99; ENTITIES W11110#99; DETAILS P1000#99)
WHEN F0701 EQ 99
F0703=55
END WHEN
End CalculationBlock