Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
subbareddykm
Creator II
Creator II

Dynamic

HI All,

I have a script like below,

Data:

LOAD [Col 1],

  [Col 2],

  [Col 3],

  [Col 4],

  [Col 5],

  [Col 6],

  [Col 7],

  'Data 001' as Flag

FROM (ooxml, embedded labels, table is Sheet1);

Concatenate

LOAD [Col 1],

  [Col 2],

  [Col 3],

  [Col 4],

  [Col 5],

  [Col 6],

  [Col 7],

  'Data 002' as Flag

FROM (ooxml, embedded labels, table is Sheet1);

Concatenate

LOAD [Col 1],

  [Col 2],

  [Col 3],

  [Col 4],

  [Col 5],

  [Col 6],

  [Col 7],

  'Data 003' as Flag

FROM (ooxml, embedded labels, table is Sheet1);

STORE Data into FinalData.Qvd(Qvd);

My requireemen is to automate my loading  is,

In my folder files are having like Data 001,Data 002,Data 003 and so on....

Now i am loading manually and creating flag with File name and storing into single file.

If i have 100 files in my folder i can't load them and create flag with file manually.

Can any one tell me how to write loops for this....?

THANKQ IN ADV

18 Replies
subbareddykm
Creator II
Creator II
Author

Data :

LOAD *,

  FILENAME() as Flag;

SELECT *

  FROM [QVDB].[dbo].[Data_*];

STORE Data into Data.Qvd(Qvd);

Actual My DB Table name will look like Data_001,Data_002 and so on.

My above script is not working..

Can anyone suggest how to do it ?

avinashelite

This works fine with flat files not with the DB!! you need write multiple load statements or stored proc for this 

PrashantSangle

Hi,

Can you post the error which you are getting??

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
its_anandrjs

If you have DB tables then use the Loop here for loading multiple loads from SQL DB.

Regards

Anand

Anonymous
Not applicable

you could try something like that, but the question is, where you get your max table number from:

for i=1 to 100

Data :

LOAD *,$(i) as Flag;

SQL

SELECT *   FROM [QVDB].[dbo].[Data_$(i)];

NEXT

subbareddykm
Creator II
Creator II
Author

for i=1 to 100

Data :

LOAD *,$(i) as Flag;

SQL

SELECT *   FROM [QVDB].[dbo].[Data_$(i)];

NEXT

Above code will execute 1 t0 100,

But If want to by user selection how to write a code for it...

Let say my user will say 4,17,31,65,89 etc to load.... will loop will work here ?

Please suggest some inputs here

techvarun
Specialist II
Specialist II

In this case, You have to load the entire data from DB and need to apply the filter in Where Clause or in front end.

subbareddykm
Creator II
Creator II
Author

Is there any other solution?

Anonymous
Not applicable

we talk about users @ QlikView SERVER?