Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
DavidJG
Contributor III
Contributor III

loading prespecified fields in a loop

Hi new and hope someone can lend me some some help structuring the loading  of my data.

I loop through a bunch of tables and selecting everything and store each table.

The problem I'm having is that some tables have many columns that I don't need (too slow load right now..) and I need to restrict those but I do not want to specify every field name for every table..  

Right now it looks like this:

 

Let t = 0;
Let vTableName = peek('TableName', t, 'Tables');

Do While Not(IsNull(vTableName))
tmpTable:
SQL SELECT *
FROM $(vPath);

STORE tmpTable INTO $(TableName).qvd;
Drop table tmpTable;

Let t = t + 1;
Let vTableName = peek('TableName', t, 'Tables');
Loop

 

The thing I'm trying to do is some kind of logic where "if there is a list of field names, load those fields, else load everything". I have tried using a variable to specify which fields should be loaded but I keep failing to do default case "select everything if vF is empty/null"

let vF = 'A,B,C';

tmpTable:
SQL SELECT $(vF)
FROM $(vPath);

I just wanted to keep a small neat loop instead of having one select for every table, is this possible or should I loop over all tables which I want everything and have a select for all the "special cases" as there own selects?.

0 Replies