Hello guys,
I'm trying to read some tables from a website, but sometimes the table I'm looking for is the table @5, sometimes the table 2, or even 3... The fact is that I have to read always the last available table.
How can I do that?
For each company in $(companies)
LOAD *, '$(companies)' as NCIA
FROM
[https://www.flightera.net/en/airline/$(companies)?orderby=reg&direction=asc&offset=800#plane_list]
(html, utf8, UserAgent is 'Mozilla/5.0', no labels, table is @5);
Next companies
I was trying to use something like ... no labels, table is max(table));... por it's not working
Is there any way of doing that?
Thank you guys
Hi @brunolelli87 ,
The script below should pull the max table available for the weblink. The first part up until *** End **** checks what is the max page available and then stores it into a variable maxPage. Hope this helps.
For each company in $(companies)
// ****** Script to check max page available ******************
let searchMaxTable = True();
let page = 1;
set errormode = 0;
do while searchMaxTable
Temp:
first 1
LOAD *
FROM
[https://www.flightera.net/en/airline/$(companies)?orderby=reg&direction=asc&offset=800#plane_list]
(html, utf8, UserAgent is 'Mozilla/5.0', embedded labels, table is @$(page));
drop table Temp;
if $(ScriptErrorCount) > 0 then
let maxPage = $(page) - 1;
set errormode = 1;
searchMaxTable = false();
else
let page = $(page)+1;
ENDIF
loop
// ****** End ****************************************
LOAD *, '$(companies)' as NCIA
FROM
[https://www.flightera.net/en/airline/$(companies)?orderby=reg&direction=asc&offset=800#plane_list]
(html, utf8, UserAgent is 'Mozilla/5.0', no labels, table is @$(maxPage));
Next companies
Hello @brunolelli87 ,
Could you provide more information? Which table do you want? For example, when I chose for KLM Cityhopper. https://www.flightera.net/en/airline/KLM+Cityhopper?orderby=reg&direction=asc&offset=800#plane_list
Regards Eddie
Hi @brunolelli87 ,
The script below should pull the max table available for the weblink. The first part up until *** End **** checks what is the max page available and then stores it into a variable maxPage. Hope this helps.
For each company in $(companies)
// ****** Script to check max page available ******************
let searchMaxTable = True();
let page = 1;
set errormode = 0;
do while searchMaxTable
Temp:
first 1
LOAD *
FROM
[https://www.flightera.net/en/airline/$(companies)?orderby=reg&direction=asc&offset=800#plane_list]
(html, utf8, UserAgent is 'Mozilla/5.0', embedded labels, table is @$(page));
drop table Temp;
if $(ScriptErrorCount) > 0 then
let maxPage = $(page) - 1;
set errormode = 1;
searchMaxTable = false();
else
let page = $(page)+1;
ENDIF
loop
// ****** End ****************************************
LOAD *, '$(companies)' as NCIA
FROM
[https://www.flightera.net/en/airline/$(companies)?orderby=reg&direction=asc&offset=800#plane_list]
(html, utf8, UserAgent is 'Mozilla/5.0', no labels, table is @$(maxPage));
Next companies