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: 
adamdavi3s
Master
Master

Why is my table inside a loop not being created

Hi All,

Having a blonde moment today.

I am doing some work with the governance dashboard and adding a check to see if the files still exist or not.

The script executes fine and I can see what I expect in the log, but no table is created. Just nada, not even the columns appended to the existing table.

I know the IF in the load isn't required but I was trying to force it to create the table

This is the script:

FileList:

LOAD LoadDateKey,

     CalDataKey,

     LoadDateNum,

     LoadDate,

     DocName,

     Size,

     FileTime,

     FileDate,

     Path,

     AccessPath,

     FileLevel,

     FileCount,

     FileName,

     Extension,

     FileType,

     PathNumber,

     [QVW Name]

FROM

(qvd);

LET NumRows=NoOfRows('FileList');

FOR i=1 to $(NumRows)

  LET vFileCheker=Peek('FileName',$(i));

  Let baseFileSizeCheck = IF(LEN(FileSize('$(vFileCheker)'))<1,0,1);

  check:

  LOAD

  $(i) as rownumber,

  '$(vFileCheker)' as FileNameABC,

  IF($(baseFileSizeCheck) > 0 ,'yes','no')  as FileExistsFlag;

NEXT;

Some output from the log:

2016-08-25 11:05:32      431 lines fetched

2016-08-25 11:05:32 0043 LET NumRows=NoOfRows('FileList')

2016-08-25 11:05:32 0044 FOR i=1 to 431

2016-08-25 11:05:32 0045

2016-08-25 11:05:32 0045   LET vFileCheker=Peek('FileName',1)

2016-08-25 11:05:32 0046   Let baseFileSizeCheck = IF(LEN(FileSize('D:\QlikView\Published Apps\DEMO\ v4.01 1024x768.qvw'))<1,0,1)

2016-08-25 11:05:32 0047   check:

2016-08-25 11:05:32 0048   LOAD

2016-08-25 11:05:32 0049   1 as rownumber,

2016-08-25 11:05:32 0050   'D:\QlikView\Published Apps\DEMO\v4.01 1024x768.qvw' as FileNameABC,

2016-08-25 11:05:32 0051   IF(1 > 0 ,'yes','no')  as FileExistsFlag

2016-08-25 11:05:32 0053 NEXT

2016-08-25 11:05:32 0045   LET vFileCheker=Peek('FileName',2)

2016-08-25 11:05:32 0046   Let baseFileSizeCheck = IF(LEN(FileSize('D:\QlikView\Published Apps\DEMO\template.qvw'))<1,0,1)

2016-08-25 11:05:32 0047   check:

2016-08-25 11:05:32 0048   LOAD

2016-08-25 11:05:32 0049   2 as rownumber,

2016-08-25 11:05:32 0050   'D:\QlikView\Published Apps\DEMO\template.qvw' as FileNameABC,

2016-08-25 11:05:32 0051   IF(1 > 0 ,'yes','no')  as FileExistsFlag

2016-08-25 11:05:32 0053 NEXT

2016-08-25 11:05:32 0045   LET vFileCheker=Peek('FileName',430)

2016-08-25 11:05:32 0046   Let baseFileSizeCheck = IF(LEN(FileSize('D:\QlikView\Published Apps\SystemMonitoring\test file123.qvw'))<1,0,1)

2016-08-25 11:05:32 0047   check:

2016-08-25 11:05:32 0048   LOAD

2016-08-25 11:05:32 0049   430 as rownumber,

2016-08-25 11:05:32 0050   'D:\QlikView\Published Apps\SystemMonitoring\test file123.qvw' as FileNameABC,

2016-08-25 11:05:32 0051   IF(0 > 0 ,'yes','no')  as FileExistsFlag

1 Solution

Accepted Solutions
Colin-Albert

Try adding an AUTOGENERATE N command,

LOAD  

     $(i) as rownumber, 

     '$(vFileCheker)' as FileNameABC, 

     IF($(baseFileSizeCheck) > 0 ,'yes','no')  as FileExistsFlag

AUTOGENERATE 1

View solution in original post

3 Replies
Anil_Babu_Samineni

Adam, Are you getting any ERROR?

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Colin-Albert

Try adding an AUTOGENERATE N command,

LOAD  

     $(i) as rownumber, 

     '$(vFileCheker)' as FileNameABC, 

     IF($(baseFileSizeCheck) > 0 ,'yes','no')  as FileExistsFlag

AUTOGENERATE 1

adamdavi3s
Master
Master
Author

*facepalm*

Schoolboy error