Loop different Anatella graphs.
The loopAnatellaGraphAdv action is very similar to the loopAnatellaGraph action described in the previous section (section 5.20.5). The two differences are:
•While the loopAnatellaGraph action always run the same “sub-graph” (i.e. the same .anatella file), the loopAnatellaGraphAdv action can run different “sub-graphs” at each different iteration of the loop.
•While the loopAnatellaGraph action changes, at each iteration, the value of one Global Parameter (whose name is, by default, “gpname”), the loopAnatellaGraphAdv action changes, at each iteration, the value of several Global Parameter.
The procedure to create a loop inside Anatella always involves (at least) two graphs (i.e. two .anatella files):
1.The first graph is the “control” graph: it’s running the loop and decide how much iterations will be performed.
2.The second graph is the “inner part” of the loop (it’s also named the “sub-graph”): it defines which Actions will be executed as part of the loop. This graph will be executed several times. At each execution (i.e. at each iteration of the loop), the “inner” graph is executed with a different set of values inside its “graph global parameters”: see sections 4.7.1. and 5.1.5 to know more about “graph global parameters”.
Let’s assume that we want to extract, each day, the content of a table stored in a remote database and save this content inside different .gel_anatella files (one file per day). We could simply run one Anatela graph, each day, that performs the extraction. …but what’s happening if this graph is not executed at one specific day? The corresponding .gel_anatella files won’t be created and some data will be missing. So, a better solution would be to check if all the .gel_anatella files from the last 10 days have been correctly created. …and if some .gel_anatella files are missing, run a graph to create them.
One easy way to check if a file is present/missing is to use the fileListFromObsDate action available in the “Other” category (see section 5.22.5). For example, these parameters will generate a table that contains (for the last 10 days): the name of all the .gel_anatella files that are missings :
The “C20_sql_loop_inner_part.anatella” file is the sub-graph executed at each iteration of the loop. It contains two graph-global-parameters: “myDate” and “myFile”. You can see these 2 graph-global-parameters here (Select the option “Graph Global Parameters” inside the “Edit” drop-down menu to see this Window):
In the above screenshot, you can see that we entered some specific “default” values for the two graph global parameters (i.e. we used the “default” values “data_20170206.gel_anatella” and “20170206”). These “default” values are useful because they allow you to easily “debug” your sub-graph (when initially creating the subgraph). During the loop execution (i.e. when running the “control” graph), these values will be discarded and replaced by the values computed inside the “control” graph (More precisely: these values are extracted from the input table of the loopAnatellaGraphAdv action).
This is the “C20_sql_loop_inner_part.anatella” sub-graph: