Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

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
cclayford
Partner - Creator
Partner - Creator
Author

See my reply at 03 Nov 2017 2:15 PM

It might be worth you troubleshooting this with the script?

stabben23
Master
Master

I actually did a test, if I switch order of Next it Works. if a keep it Next a Next b it fails as in Your case.

for each a in 586,591,600
for each b in 'test1', 'test2', 'test3'

next
next a

cclayford
Partner - Creator
Partner - Creator
Author

That works, but i still get those errors in between the other tables loading:

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.....ect

stabben23
Master
Master

Hi Christopher

This was a tricky one, finally I find a solution which a hope fits Your requierment.

fieldlist:
Load * Inline [
Field, http
"Premier League 17/18 League table", 586
"Bundesliga 17/18 League table", 591
"La Liga 17/18 League table", 600
"French Ligue 1 17/18 League table", 594
"Eredivisie 17/18 League table", 599
"Serie A 2017/18 League table", 593
"Scottish Premiership 17/18 League table", 590
]
;

for i= 1 to NoOfRows('fieldlist')-1 //count the rows in table fieldlist
let a =FieldValue('http',$(i));
let b =FieldValue('Field',$(i));

tables:
LOAD
# as [Pos],
Clubs as [Team],
P,
W,
D,
L,
F,
A ,
GD,
Points as [Pts],
'$(b)'
as [Table Type]
FROM

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

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

next i

cclayford
Partner - Creator
Partner - Creator
Author

Amazing! That works perfectly. Thanks for all the help

stabben23
Master
Master

Hi,

just one more, change this row, should not have -1

for i= 1 to NoOfRows('fieldlist') //count the rows in table fieldlist

stabben23
Master
Master

Great, sporttables is very important Things I'm a big sportfan.

cclayford
Partner - Creator
Partner - Creator
Author

Glad to hear. I have built a cricket and rugby app as well. Send me your email address and i will send you a link to my Qlik Cloud account so that you may view it. Will upload the football one as soon as i am done with it