Qlik Community

Connectivity & Data Prep

Discussion board where members can learn more about Qlik Sense Data Connectivity.

Announcements
QlikWorld online is next week! REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
BN
Contributor II
Contributor II

Loading Data from a website

Hello Everyone 

I am trying to Load Data from https://www.baaa-acro.com/crash-archives but i keep getting an unkown error.  With this code i got only 260 lines fetched 

for i=1 to 1375

let vPage= 'https://www.baaa-acro.com/crash-archives' & if($(i)>1,$(i),'') & '.htm';


LOAD
//Image,
"Date",
Operator,
"A/C Type",
Location,
Fatalities,
Registration
//F8
FROM [lib://Aviation-Crashes]
(html, utf8, embedded labels, table is @1; //filters(


next

BN_0-1627751492354.png

I then tried this code and only got to 1305 lines. 

FOR vsCounter = 1 TO 1375

LET vsPage = If($(vsCounter) = 1, 20, 27488 + $(vsCounter) - 1);

LET vsURL = 'https://www.baaa-acro.com/crash-archives' & '$(vsPage)' & '.htm';


SET ErrorMode = 0;


LOAD

@2 AS [Date],

@3 AS [Operator],

@4 AS ["A/C Type"],

@5 AS [Location],

@6 AS [Fatalities],

@7 AS Registration

 

FROM [lib://Aviation-Crashes]
(html, utf8, no labels, table is @1);

// WHERE Recno() > 4;


SET ErrorMode = 1;

NEXT

 I am not sure what the error is, if someone, anyone can help me please.

1 Solution

Accepted Solutions
Gui_Approbato
Creator III
Creator III

Hello,

The page parameter is not included in your url.

I made this video to show how I fixed it https://youtu.be/S0NG4vJ-j9w .

In short, find the script below:

for i=0 to 10

let vPage= 'https://www.baaa-acro.com/crash-archives?page=' & '$(i)';

Trace '$(i)';

LOAD
//Image,
'$(i)' as Page,
"Date",
Operator,
"A/C Type",
Location,
Fatalities,
Registration
//F8
FROM [lib://Aviation-Crashes]
(url is  '$(vPage)',html, utf8, embedded labels, table is @1;

next i

 

Regards

View solution in original post

1 Reply
Gui_Approbato
Creator III
Creator III

Hello,

The page parameter is not included in your url.

I made this video to show how I fixed it https://youtu.be/S0NG4vJ-j9w .

In short, find the script below:

for i=0 to 10

let vPage= 'https://www.baaa-acro.com/crash-archives?page=' & '$(i)';

Trace '$(i)';

LOAD
//Image,
'$(i)' as Page,
"Date",
Operator,
"A/C Type",
Location,
Fatalities,
Registration
//F8
FROM [lib://Aviation-Crashes]
(url is  '$(vPage)',html, utf8, embedded labels, table is @1;

next i

 

Regards