Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Qlik Experts,
I am experiencing an issue where including commands within a loop does not work as expected. However, I have noticed that when I place the "include" statement outside the loop, the function functions properly. Could you provide any insights into why this might be happening? The include statement got a subroutine. (When i include a example table it works), but it doesnt work for subroutines.
FOR EXAMPLE:
I think you are struggling with the validity of variables because within script control statements created variables are not global variables. It's a common behaviour of programming tools and also the basis below the Qlik script-layer.
I have also dozens of include-variables with a lot of path/file-formatting/connections variables, functions and routines, various loads, comments and tags and so on and also cleaning/finishing (dropping tables/fields/variables, renaming them, moving/storing sources/log-files and so on) the load in the end.
The common ones are logically grouped in another one and even those are partly also grouped. So I need just to specify a few includes at the beginning and the end - the common ones and the specific ones (for example section access tables).
@SonPhanHumanIT I think you need to call your subroutine in the loop to work it properly
Call SubRoutine_Name;
thanks for the info, unfortunately I will need this outside the loop!
@SonPhanHumanIT what you are trying to achieve in loop?
I possess several subroutines that are based on an Excel file. I will include the necessary subroutine from the file, which will be required in the script at a later stage.
@SonPhanHumanIT I have just tested that if you call the sub routine within loop using include statement it works. So Include statement in loop should work fine it's just that you need to call subroutine within loop itself instead outside of loop like below.
If you want to call your subroutine outside of loop you need to again call the include statement outside of the loop to work as expected which will work only for last iteration of loop.
I think you are struggling with the validity of variables because within script control statements created variables are not global variables. It's a common behaviour of programming tools and also the basis below the Qlik script-layer.
I have also dozens of include-variables with a lot of path/file-formatting/connections variables, functions and routines, various loads, comments and tags and so on and also cleaning/finishing (dropping tables/fields/variables, renaming them, moving/storing sources/log-files and so on) the load in the end.
The common ones are logically grouped in another one and even those are partly also grouped. So I need just to specify a few includes at the beginning and the end - the common ones and the specific ones (for example section access tables).