Skip to content

Monthly and cumulated values

A THKML script can read and store both monthly and cumulated values. Let's see in detail the syntaxes to use:

  • Per - Monthly data;
  • Pro - Cumulated data;
  • Per(N) with N integer - Custom period length. This syntax allows to read data from a scenario which is not the current one. For example if we use the syntax Per(24) from the period 06 of the scenario N the system calculates periodical data as follows: Scenario N | Period 06 (cumulated) + Scenario N-1 | Period 12 (cumulated) + Scenario N-2 | Period 12 (cumulated) - Scenario N-2 | Period 06 (cumulated).

Example: [LO].[X00000](Pro,Dest1.Filter([D11])) := [C00000](Per);

Inserting the period length information before the filters or the reading from fixed point is considered to be a best practice.

Data reading

By default, the system reads data as they are stored in the database, namely it read cumulated data. If the user needs to read monthly data he has to use the Per syntax as shown below.

Let us assume that data on the database are the following:

Entity Account Scenario Category Dest1 Dest2 Period Amount
A00 C00000 2013BDG $AMOUNT GEN GEN 01 50
A00 C00000 2013BDG $AMOUNT GEN GEN 02 80
A00 C00000 2013BDG $AMOUNT GEN GEN 03 110
A00 C00000 2013BDG $AMOUNT GEN GEN 04 125
A00 C00000 2013BDG $AMOUNT GEN GEN 05 160
A00 C00000 2013BDG $AMOUNT GEN GEN 06 215

and that we read periodical data

... := [C00000](Per);

Read data are the following:

Entity Account Scenario Category Dest1 Dest2 Period Amount
A00 C00000 2013BDG $AMOUNT GEN GEN 01 50
A00 C00000 2013BDG $AMOUNT GEN GEN 02 30
A00 C00000 2013BDG $AMOUNT GEN GEN 03 30
A00 C00000 2013BDG $AMOUNT GEN GEN 04 15
A00 C00000 2013BDG $AMOUNT GEN GEN 05 35
A00 C00000 2013BDG $AMOUNT GEN GEN 06 55

Periodical data makes sense only for P&L or Other Variations account types.

Data storing

By default the system stores the calculated value for a given period only on that period. If the user needs to store cumulated data he has to use the Pro syntax as shown below.

Let us assume that data on the database are the following:

Entity Account Scenario Category Dest1 Dest2 Period Amount
A00 C00000 2013BDG $AMOUNT GEN GEN 01 50
A00 C00000 2013BDG $AMOUNT GEN GEN 02 80
A00 C00000 2013BDG $AMOUNT GEN GEN 03 110
A00 C00000 2013BDG $AMOUNT GEN GEN 04 125
A00 C00000 2013BDG $AMOUNT GEN GEN 05 160
A00 C00000 2013BDG $AMOUNT GEN GEN 06 215

and that we have the following script [LO].[X00000](Pro) := [C00000](Per);

Read data are the following:

Entity Account Scenario Category Dest1 Dest2 Period Amount
A00 C00000 2013BDG $AMOUNT GEN GEN 01 50
A00 C00000 2013BDG $AMOUNT GEN GEN 02 30
A00 C00000 2013BDG $AMOUNT GEN GEN 03 30
A00 C00000 2013BDG $AMOUNT GEN GEN 04 15
A00 C00000 2013BDG $AMOUNT GEN GEN 05 35
A00 C00000 2013BDG $AMOUNT GEN GEN 06 55

Data stored on the database are the following:

Entity Account Scenario Category Dest1 Dest2 Period Amount
A00 X00000 2013BDG $AMOUNT GEN GEN 01 50
A00 X00000 2013BDG $AMOUNT GEN GEN 02 50+30
A00 X00000 2013BDG $AMOUNT GEN GEN 03 50+30+30
A00 X00000 2013BDG $AMOUNT GEN GEN 04 50+30+30+15
A00 X00000 2013BDG $AMOUNT GEN GEN 05 50+30+30+15+35
A00 X00000 2013BDG $AMOUNT GEN GEN 06 50+30+30+15+35+55