Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
An issue has been identified on Qlik Cloud hub, please visit our Status Update Page for details: GET THE LATEST
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.

1 Solution

Accepted Solutions
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

View solution in original post

27 Replies
stabben23
Master
Master

Hi Christopher,

if you add filelist, will that work?

for each a in filelist('586',591'......)

for each b in filelist('Prem.....)

cclayford
Partner - Creator
Partner - Creator
Author

Unfortunately that does not work, i get this syntax error:

3.png

effinty2112
Master
Master

Hi Christopher,

Try putting single quotes around your dollar sign expansions,

... comp_id = '$(a)'

...table is ['$(b)'  League Table]

Regards

Andrew

PS C'mon the Gers!

stabben23
Master
Master

ok, try then to add singlequote around Your variables, '$(a)' '$(b)' and delete filelist as mention above.

cclayford
Partner - Creator
Partner - Creator
Author

Nope that gives me this error:

4.PNG

I can however confirm that if i load it without the "filelist" syntax, and single quotes, it does load the first comp_id, and table, but not the following ones:

5.png

stabben23
Master
Master

Ok, one step further, and all URL is exactly the same except comp_id number?

cclayford
Partner - Creator
Partner - Creator
Author

Yes that's correct.

stabben23
Master
Master

ok, if you press OK, will it go on and try to load NEXT table. Click OK until Your loop is finished.

Maybe it will find some in Your interval.

cclayford
Partner - Creator
Partner - Creator
Author

It only found the first table:

6.PNG