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: 
shane_spencer
Specialist
Specialist

Dynamic Load all Tables from Web File

I've got a web file that I need to load certain tables from. So the first thing I need to do is load Row 1 of Field @1 from ALL tables. I've written a little Loop script. In the attached example is 24 tables but in some files I'll have more or less tables so I want to set this as a variable for the last table number. Any ideas?

For vTableNo = 1 to 24

TABLES:

LOAD @1 as TableType,

$(vTableNo) as TableNo

FROM

TandE_Reviewer_029229G_25_05_2018.html

(html, codepage is 1252, no labels, table is @$(vTableNo))

Where RecNo()=1

;

Next vTableNo

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Hi Shane,

Have a look at the attached file. I believe this should work ( XML loading have all the table details and I am using one of the field to get the table count) for all the files. Just to make sure kindly test all your files and let me know if you face any issues.

View solution in original post

6 Replies
tamilarasu
Champion
Champion

Hi Shane,

Have a look at the attached file. I believe this should work ( XML loading have all the table details and I am using one of the field to get the table count) for all the files. Just to make sure kindly test all your files and let me know if you face any issues.

shane_spencer
Specialist
Specialist
Author

Thanks. I've only got one web file myself to test with so will have to check when I get more. My other alternative is to use error trapping i.e.

//load row 1, field 1 of all possible tables

ErrorMode=0

For vTableNo = 1 to 100000

TABLES:

LOAD @1 as TableType,

$(vTableNo) as TableNo

FROM

TandE_Reviewer_029229G_25_05_2018.html

(html, codepage is 1252, no labels, table is @$(vTableNo))

Where RecNo()=1

;

//If table not found exit loop

If ScriptError=10 then

Exit For

End If

Next vTableNo

ErrorMode=1

tamilarasu
Champion
Champion

That is also good option . But I don;t think you will have 1 lakh tables in single html file .

shane_spencer
Specialist
Specialist
Author

Haan yaar, I decided to go high rather than too low.

tamilarasu
Champion
Champion

Shane -Agree, I was simply saying . Do you speak Hindi?

shane_spencer
Specialist
Specialist
Author

Only a few phrases I picked up from colleagues.