How does the system delete and store calculated data
When a MD calculation logic is run, in order to store calculated data to the application database tables the system performs the following steps:
- deletes data from the destination tables, filtering by:
- output account, namely the account calculated by using the TGKML script
- origin (PROC_CALCULATED or PROC_CALCULATED_BASIC depending whether the calculation logic is of "Base" or "Other" type);
- filtered or overridden dimensions
- stores in the data tables the difference between the result of the TGKML script and already present data with origin different form PROC_CALCULATED or PROC_CALCULATED_BASIC filtering by output account, filtered or overridden dimensions. Thus it works in "compensation" mode. Let's see some examples to explain this concept.
EXAMPLE 1: Let us assume that we have a script which calculates the value of the account X00000, that the calculated value is 150 and that data on the database before running the script are the following:
| Account | Amount | Origin |
|---|---|---|
| X00000 | 10 | PROC_CALCULATED |
| X00000 | 80 | INPUT_DEFORM |
After the deletion, data on the database are the following:
| Account | Amount | Origin |
|---|---|---|
| X00000 | 80 | INPUT_DEFORM |
Being the calculated value 150, data after the storing are the following:
| Account | Amount | Origin |
|---|---|---|
| X00000 | 70 | PROC_CALCULATED |
| X00000 | 80 | INPUT_DEFORM |
ForceDelete¶
When it is necessary to force a precise deletion even when a global deletion is planned, it is possible to use the ForceDelete syntax as output specifications for journal statement on physical accounts
For example, you can write:
[LO].[X00000](Entity.Filter([A00]), ForceDelete) := ...