Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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

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