3 Replies Latest reply: Aug 25, 2016 6:23 AM by Adam Davies RSS

    Why is my table inside a loop not being created

    Adam Davies

      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
      [D:\QlikView\Published Apps\SystemMonitoring\QVGD_FileList_2.0.1.qvd]
      (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