Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
srihitha
Contributor III
Contributor III

scope of variables

what is the scope of variables in qlik sense?

Are all variables global in qlik sense

Labels (3)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

Yes you can use the variable after a loop, but be aware that in your example the variable will be 10 outside of the loop.

SET var=;
For var = 0 to 9 
    Trace In loop var=$(var);//The variable will be between 0-9
Next var                     //the var value increase with +1. When >9 the loop stops.
Trace After loop var=$(var);  //The variable is now 10

View solution in original post

3 Replies
Vegar
MVP
MVP

Yes, I would say that you can consider all variables in an Qlik Sense application as global, with exceptions for local variables within a SUB

However, you might run into vG. (global) and vL. (local) variables if you run into environments using the QDF standard variable naming conventions. In this cases the local/global has no technical limitations,  it is only limited by naming and usage conversions set by the framework. 

 

srihitha
Contributor III
Contributor III
Author

so,if i create a variable called "var" using for..next loop in one table,Can I use that variable in other table?

ex: for var=1 to 9....next

 

Vegar
MVP
MVP

Yes you can use the variable after a loop, but be aware that in your example the variable will be 10 outside of the loop.

SET var=;
For var = 0 to 9 
    Trace In loop var=$(var);//The variable will be between 0-9
Next var                     //the var value increase with +1. When >9 the loop stops.
Trace After loop var=$(var);  //The variable is now 10