I'm trying to run this code, but sometimes I'm getting the following error message:
// Compondo o grupo das empresas
SET NomeEmpresas= 'AALR3', 'ABEV3', 'AFLT3', 'AGRO3', 'AHEB3', 'AHEB5', 'ALPA3', 'ALPA4', 'ALSO3';
For each Ticker in $(NomeEmpresas)
'$(Ticker)' as STCK,
(html, utf8, UserAgent is 'Mozilla/5.0', embedded labels, table is @2);
Table not found error
Table '@2' not found
'AFLT3' as STCK,
(html, utf8, UserAgent is 'Mozilla/5.0', embedded labels, table is ***)
Which is absolutely correct, once there is no Table 2 (@2) available on ...AFLT3.SA website.
My question is:
How can I create a code to check if the table exists or not, and in negative cases, just move to the next Ticker!