Skip to content

LoopOnTime

Generally, when a TGKML script is run on several scenarios / periods at the same time, the system calculates data and then stores them all at once to the database and not one scenario / period per time.

Whether the user needed to manage the same account as output and as input within the same script, for example to value data on several months using, per each month, previous month's data and wrote an assignment of the following type:

[LO].[X00000] := [X00000](Time.Prev)

this assignment wouldn't give any result.

Indeed, in these cases it is necessary to use a specific syntax: the LoopOnTime and then write

[LO].[X00000](LoopOnTime) := [X00000](Time.Prev)

When the LoonOnTime is used, technically the system calculates and writes data one scenario / period per time.

When the accounts to value are more than one and they refer to each other and thus it is necessary to run a set of assignment n times, one for each scenario/period specified in the filter, then it is necessary to use the LoopOnTime syntax and write

<< "LoopOnTimeOn";

assignment 1

assignment 2

assignment 3

<< "LoopOnTimeOff";

In this way the system runs the assignment 1 on the first scenario/period, then the assignment 2 on the first scenario/ period, then the assignment 3 on the first scenario period and then the same assignments on the scenario/period 2 and so on.

The LoopOnTimeOn syntax has to be used only when it is really necessary since it can delay the script runtime.

LoopOnTime(Scenario)

If the user needs to use, within the same script, the same account as output and as input, for example to build data using data of the previous scenario and not of the previous scenario/period, it he can use the syntax LoopOnTime(Scenario)and then write, for example

[LO].[X00000](LoopOnTime(Scenario)) := [X00000](Time.Prev)

Technically, when using the syntax LoopOnTime(Scenario), the system calculates and writes data scenario by scenario.

When the accounts to build are more than one and they are related to each other and therefore it is necessary to run a set of assignments n times, one for each scenario specified in the filter, the syntax to use is LoopOnTimeOn(Scenario) and then write

<< "LoopOnTimeOn(Scenario)";

assignment 1

assignment 2

assignment 3

<< "LoopOnTimeOff";

In this way, the system runs the assignment 1 on the first scenario, then the assignment 2 on the first scenario, then the assignment 3 on the first scenario and then the same assignments on the scenario 2 and so on.