Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I have a simple For loop statement that for some reason will only return one row. For this particular load there are 3 rows in the Tracker table, each with a unique ID (PK_gameId). The Fixture qvd has thousands of rows so I need to reduce it to only the rows containing IDs in the Tracker qvd.
vNumRows evaluates to 3 which is perfect. vFixtures evaluates to the unique ID in the first row. When I load the Fixture table I only get 1 row instead of 3.
Tracker:
Load
PK_gameId
FROM [D:\QlikView\DEV\DBQVD\Soccer\ReportsTracker.qvd] (qvd)
where Report_Status = 0;
let vNumRows =NoOfRows('Tracker');
For i = 0 to $(vNumRows)
LET vFixtures = Peek('PK_gameId',i,'Tracker');
Fixture:
LOAD *
FROM [D:\QlikView\LIVE\DBQVD\Soccer\db_Fixtures.qvd] (qvd)
where PK_gameId = $(vFixtures);
Probably need single quotes in where condition
Tracker:
Load
PK_gameId
FROM [D:\QlikView\DEV\DBQVD\Soccer\ReportsTracker.qvd] (qvd)
where Report_Status = 0;
let vNumRows =NoOfRows('Tracker');
Fixture:
load * inline [
Temp ];
For i = 0 to $(vNumRows)
LET vFixtures = Peek('PK_gameId',i,'Tracker');
concatenate(Fixture)
LOAD *
FROM [D:\QlikView\LIVE\DBQVD\Soccer\db_Fixtures.qvd] (qvd)
where PK_gameId = '$(vFixtures)';
next
drop field Temp;
try below
Tracker:
Load
PK_gameId
FROM [D:\QlikView\DEV\DBQVD\Soccer\ReportsTracker.qvd] (qvd)
where Report_Status = 0;
let vNumRows =NoOfRows('Tracker');
Fixture:
load * inline [
Temp ];
For i = 0 to $(vNumRows)
LET vFixtures = Peek('PK_gameId',i,'Tracker');
concatenate(Fixture)
LOAD *
FROM [D:\QlikView\LIVE\DBQVD\Soccer\db_Fixtures.qvd] (qvd)
where PK_gameId = $(vFixtures);
next
drop field Temp;
Hi Kush, that almost worked. After it loops through all the rows it doesn't end - it tries to continue looping which results in an error.
Probably need single quotes in where condition
Tracker:
Load
PK_gameId
FROM [D:\QlikView\DEV\DBQVD\Soccer\ReportsTracker.qvd] (qvd)
where Report_Status = 0;
let vNumRows =NoOfRows('Tracker');
Fixture:
load * inline [
Temp ];
For i = 0 to $(vNumRows)
LET vFixtures = Peek('PK_gameId',i,'Tracker');
concatenate(Fixture)
LOAD *
FROM [D:\QlikView\LIVE\DBQVD\Soccer\db_Fixtures.qvd] (qvd)
where PK_gameId = '$(vFixtures)';
next
drop field Temp;