Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

adamdavi3s
Honored Contributor

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

Re: Why is my table inside a loop not being created

Try adding an AUTOGENERATE N command,

LOAD  

     $(i) as rownumber, 

     '$(vFileCheker)' as FileNameABC, 

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

AUTOGENERATE 1

3 Replies

Re: Why is my table inside a loop not being created

Adam, Are you getting any ERROR?

Life is so rich, and we need to respect to the life !!!

Re: Why is my table inside a loop not being created

Try adding an AUTOGENERATE N command,

LOAD  

     $(i) as rownumber, 

     '$(vFileCheker)' as FileNameABC, 

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

AUTOGENERATE 1

adamdavi3s
Honored Contributor

Re: Why is my table inside a loop not being created

*facepalm*

Schoolboy error

Community Browser