SET expression
To simplify the definition of a given dimension's elements set and to allow to reuse this set several times in a TGKML script without defining the set each time from scratch, it is possible to use the SET expression, namely to define a sort of "alias" of a given dimension's elements set. Once the elements set is defined, the SET expression allows to call it several times in the script using the operator "@".
The syntax to use is the following:
For example, it is possible to write
- Dest1.@MY_SET_1 := [D11] + [D12] + [GEN];
In this case the defined set is MY_SET_1 which is made up of the D11, D12 and GEN elements of the custom dimension 1;
- Entity.@MY_SET_2 := [01|$];
In this case the defined set is MY_SET_2 which is made up of all the entities related to the node $ of the entity hierarchy 01;
- Dest2.@MY_SET_3 := All;
In this case the defined set is MY_SET_3 which is made up of all the elements of the custom dimension 2 table.
For the account dimension, it is possible to define a set of elements by referring to a FST item. The syntax to use is: {
For example, it is possible to write
- Account.@MY_SET_3 := ([C00000] + {S01,V0001});
In this case, the defined set is MY_SET_3 which is made up of the account C00000 and all the accounts related to the FST item V0001 of the financial statement template S01;
- [LO].@MY_SET_4:= Multi([X00000] + {S01,V0001} + {S02,V0003});
In this case the defined set is MY_SET_4 which is made up of the account X00000, and all the accounts related to the FST item V0001 of the financial statement template S01 and all the accounts related to the FST item V0003 of the FST S02;
When defining the elements list it is possible to use the following algebraic operators:
- +. elements union. For example, writing Entity.@MY_SET_4 := @MY_SET_2 + [A01]; means defining a set of entities made up of the entities of the set MY_SET_2 plus the A01 entity.
- -. Eliminate some elements from a list;
- *. Elements intersection
Once a set of elements is defined, by using the SET expression it is possible to call it using the following syntax
@
The SET expression can be used also
- in the reading from fixed point.
Dest1.@MY_SET_1 := [D11] + [D12] + [GEN]; //definition
... := [C00000](Dest1. @MY_SET_1);
to specify that the value of the account C00000 is read only from the elements D11, D12 and GEN of the custom dimension 1;
- in the overridden values definition.
Dest1.@MY_SET_1 := [D11] + [D12] + [GEN]; //definition
[C00000](Dest1.@MY_SET_1) :=...;
to specify that the script's result is written on the account X00000 and on the elements D11, D12 and GEN of the custom dimension 1;
- in the filters definition.
- in the definition of temporary accounts existing only for some determined elements (those belonging to the set defined by the SET expression)
Dest1.@MY_SET_5(@TEMP_ACCOUNT,15) := [D11] + [D12] + [GEN]; // 15 is the value of the temporary account for the elements D11,D12 and GEN of the custom dimension 1. The result of this assignment is the following
| Account | Dest1 | Amount |
|---|---|---|
| @TEMP_ACCOUNT | D11 | 15 |
| @TEMP_ACCOUNT | D12 | 15 |
| @TEMP_ACCOUNT | GEN | 15 |
- for the definition of more complex elements sets.
Dest1.@MY_SET_6(@TEMP_ACCOUNT_1,5) := [D11] + [D12]; // 5 is the value of the temporary account for the elements D11 and D12 of the custom dimension 1. The result of this assignment is the following
| Account | Dest1 | Amount |
|---|---|---|
| @TEMP_ACCOUNT_1 | D11 | 5 |
| @TEMP_ACCOUNT_1 | D12 | 5 |
Dest2.@MY_SET_7(@TEMP_ACCOUNT_2,3) := [D21] + [D22]; // 3 is the value of the temporary account for the elements D21 and D22 of the custom dimension 2. The result of this assignment is the following:
| Account | Dest1 | Amount |
|---|---|---|
| @TEMP_ACCOUNT_2 | D21 | 3 |
| @TEMP_ACCOUNT_2 | D22 | 3 |
@TEMP_RESULT := @TEMP_ACCOUNT_1 * @TEMP_ACCOUNT_2
| Account | Dest1 | Dest2 | Amount |
|---|---|---|---|
| @TEMP_RESULT | D11 | D21 | 5*3=15 |
| @TEMP_RESULT | D11 | D22 | 5*3=15 |
| @TEMP_RESULT | D12 | D21 | 5*3=15 |
| @TEMP_RESULT | D12 | D22 | 5*3=15 |