Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
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?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
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