I have a variable in my code that might or might not have been created, depending on the structure of the base_table - there are subroutines that might not have been executed and if they haven't, then the variable hasn't been created.
At a point I want to create a small aux_table with just a listname (the name of the base_list) and that variable - which is where my troubles start: I have to somehow pack this into an IF_THEN_block or something to make sure that LOAD doesn't fail and break the script in case that variable doesn't exist.
I could always set the ErrorMode to 0 to make sure the script goes over that bit, even if the LOAD fails, but I'd rather check if the variable exists. That would also help me enhance the "cleanliness" of my script and its ability to clean up after itself.
It can also happen - it does with the set of base_lists I am currently using - that all the lists are "clean", so that variable is never created in the six iterations of my entire code. Even if that happens, though, I want a qvd file to be created - otherwise it would get even more complicated, if I have to account for both the possibilities of that file being there or not ...
another possibility could be to create a variable which contains all / certain variable-names and maybe the values in a concat-string. Such string could be checked per match() or index() on certain values or looped in a for-loop with substringcount() on the choosed delimiter. This creates also an overhead but within the script there isn't any variables-object ...
=> Is there any way I can find out in my script what variables exist in the app (not in the variable_manager, but in the script)? That would be a first step towards cleaning up my script - although removing no_more_needed variables right away would certainly be better.
no, I think there isn't any way within the script. Not even a macro-function could help then reading/writing variables within the macro requires an ActiveDocument which isn't available until the script execution is finish.
So I'll just have to get better at cleaning up variables on_the_fly.
With the LEN() thing I got a little further - I can now identify whether that variable has any positive length or not - so the check works.
The last thing I noticed today before going home was that on the second iteration, for some strange reason the variable for the listname was not found ... that is one of the most fundamental things in my code and should always be there.
Well, I'll see about that on Monday. I'll have to continue a bit on that project anyway. That piece is nearly complete and already a good thing to have, but in order to really reduce manual effort for the employees there, I have to include some more data into my system.