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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creating dynamic variable names in script loop

Is it possible to dynamically create variables in a script loop.  I want to create a loop that based off the number of records in a table creates dimensions (i.e. DIM1, DIM2, DIM3, etc.).

Something like this? :

   For vI = 1 to NoOfRows('myTable')

      Let '$(DIM)'&'$(vI)' = 'static expression';

   Next vI

Thanks,

Tyler

Labels (1)
1 Solution

Accepted Solutions
Not applicable
Author

I figured it out:

  For vI = 1 to NoOfRows('myTable')

      set name = 'Dim$(vI)';

      set '$(name)' = 'static expression';

   Next vI

View solution in original post

2 Replies
Not applicable
Author

something more like this for the center of the loop probably:

set name = 'Dim' & $(vI);

set '$(name)' = 'static expression';

Not applicable
Author

I figured it out:

  For vI = 1 to NoOfRows('myTable')

      set name = 'Dim$(vI)';

      set '$(name)' = 'static expression';

   Next vI