Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
cclayford
Partner - Creator
Partner - Creator

Nested for loop not working

Hi all

I am trying to use a nested for loop in this manner:

1.png

But i keep getting this error:

2.PNG

Your help will be greatly appreciated.

Regards,

Christopher.

27 Replies
stabben23
Partner - Master
Partner - Master

If you check Your variables a and b in variable overview, what values do they have?

cclayford
Partner - Creator
Partner - Creator
Author

7.PNG

stabben23
Partner - Master
Partner - Master

ok, so a wont loop, try to delete singlequote in the list. for each a in 586, 591 ..aso

cclayford
Partner - Creator
Partner - Creator
Author

Unfortunately that did not work. Got the same result.

stabben23
Partner - Master
Partner - Master

then delete singlequote around $(a) and still no singlequote in Your list

cclayford
Partner - Creator
Partner - Creator
Author

The single quotes around $(a) and $(b) were already removed. If i add it, then it does not loop at all.

cclayford
Partner - Creator
Partner - Creator
Author

I think it will be easier for you to troubleshoot with the script:

For each a in '586','591','600','594','599','593','590';

For each b in 'Premier League 17/18','Bundesliga 17/18','La Liga 17/18','French Ligue 1 17/18','Eredivisie 17/18','Serie A 2017/18','Scottish Premiership 17/18';

[Tables]:

LOAD

# as [Pos],

     Clubs as [Team],

     P,

     W,

     D,

     L,

     F,

     A,

     GD,

     Points as [Pts],

     'League Table' as [Table Type]

FROM

[https://www.statbunker.com/competitions/LeagueTable?comp_id=$(a)]

(html, codepage is 1252, embedded labels, table is [$(b) League table]);

NEXT a;

NEXT b;

stabben23
Partner - Master
Partner - Master

ok, a numeric value in for each should not have any singlequotes and will be expaned without $(a).

text values should have singlequotes around as in b, this should expand With '$(b)'.

As you can see a wont loop for you, b will as it contains Scottish.

cclayford
Partner - Creator
Partner - Creator
Author

Ok, i removed the 'a' and 'b' next to the "NEXT" function. It now loads all the tables, but it gives me errors in between:

Tables << Premier League 17/18 League table 20 Lines fetched

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Tables << Bundesliga 17/18 League table 38 Lines fetched

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Tables << La Liga 17/18 League table 58 Lines fetched

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Tables << French Ligue 1 17/18 League table 78 Lines fetched

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Tables << Eredivisie 17/18 League table 96 Lines fetched

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Tables << Serie A 2017/18 League table 116 Lines fetched

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Cannot locate table in HTML file

Tables << Scottish Premiership 17/18 League table 128 Lines fetched

stabben23
Partner - Master
Partner - Master

what if you swith to:

Next b

Next a