I always split my script into several parts, one part of the script on one tab.
Now I have one large loop that encompasses two subroutines and several more loops
=> To the effect that the keywords "FROM ..." and "NEXT" are five tabs apart
There should actually be no big issue about that - I can easily put "NEXT [Counter]" instead of just "NEXT" and it should be clear for QlikView what is what
<=> It doesn't work: I have tested what is to be my meta_loop on its own - it parses through an inline_table with six sheet_names which correspond to the names of worksheets in an Excel_workbook.
<=> Still, when I activate this meta_loop around all the other stuff - the first time round, my counter_variable (which is not identical to any of the "inner" ones, I have named them all differently) is populated all right and so is the variable for the worksheet I'm currently processing, but after the first iteration is completed, the variable has a NULL value ...
I often add TRACE commands to output various variables whilst processing the loop so I can debug exactly what is going on from the log files or load progress window without the need to invoke the debugger.
I also add a "Trace === TabName=== ;" as the first line of every tab.
it looks that these variable will be defined several times - first in your meta-loop and then in your sub-routine and then in your meta-loop again - if yes you need some logic, either you worked with two variables and/or you need to check if the variable-value had changed.
no - I am aware of that issue, so I'm trying to give a new name to each one of my variables and I assign them a NULL value when they are not needed anymore so there can't be any confusion.
I have now successfully established a meta_routine that is called once for every one of my six sheets (six times) and that will itself call the two other subroutines. That works - but only for the first sheet (in the first iteration, my counter "superi" has the value 0 because I use the PEEK() fct. from a small inline_table to determine the name of the sheet to process.
<=> In the second iteration, "superi" has the value 1 and the table_name becomes NULL. I have yet to find out why that is happening.
P.S.: I am at a loss - when I try only that LOOP, I deactivate the CALL statement and put an EXIT SCRIPT directly after the loop, then it works - I debug it step_by_step and the current_list_variable is properly updated every time.
When, on the other hand, I activate the CALL statement and thus have all the code inbetween, then for the second iteration, "superi" (my counter) is updated from 0 to 1 - and my current_list_variable gets assigned a NULL value ...
P.P.S.: I have just performed a backward search across all tabs for the name of that counter_variable in that meta_loop, but it is definitely unique.