Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
mbespartochnyy
Contributor

Looping and Adding Values to a Variable

Hello community,

I'm working with a database that's growing not only in number of rows but also in number of columns. Each month, an additional column is created to hold forecast values for the two upcoming months. What I'm trying to do is:

  • Check number of fields in a database
  • Create enumerated set of field names (Bid1, Offer1, Bid2, Offer2, etc.)
  • Store that list in a variable and
  • Use that variable to then load all of the fields in a database

I couldn't find a better way to do this, but if there is one, please let me know. If this is the best way to go about it, does anyone know how to "concatenate" values to a variable and create a list of fields?

I've attached a sample spreadsheet and a QVW that I started to build. In the QVW, you'll see that at each loop values get replaced instead of added to the vFieldList variable. Thanks in advance for any help with this.

Mikhail Bespartochnyy

1 Solution

Accepted Solutions
mbespartochnyy
Contributor

Re: Looping and Adding Values to a Variable

Found a solution to my own problem. Turns out I had to include the variable in the loop. Attached is the revised, functioning QVW.

Mikhail B.

View solution in original post

1 Reply
mbespartochnyy
Contributor

Re: Looping and Adding Values to a Variable

Found a solution to my own problem. Turns out I had to include the variable in the loop. Attached is the revised, functioning QVW.

Mikhail B.

View solution in original post