5 Replies Latest reply: Dec 17, 2014 5:40 PM by Bart Heijne RSS

    Command to check if a QVD file exists

      My QVD files holding transactions are stored per year to be able to select data sets more easily in our QV applications.

      I want to perform an incremental reload on my transaction data. This is a sequential file holding a record number but highest written record number is not necessarily in the highest year.

      I have a transactions_2010.qvd, transactions_2009.qvd

      When performing the reload (in a loop for x number of years), I first load the data from the existing QVD file, calculate the highest record number found in the QVD file and then load the data from the transaction file for the apprioprate year and only records > highest record number in the QVD file.

      This works very good and boosts reload times.

      However, if the QVD file does not exist yet, the script fails as the read from the QVD file ends up in error (file not found).

      Is there a way in QV to check if the QVD file exists ? If it does not exist for the given year, I would perform a full load for the given year.

      So my script would be like :

      If '$(vInputIncremental)' = 'yes' then

      transactions_$(vYear).qvd (qvd);

      max(record_number) as record_number_max
      RESIDENT transactions;

      let vLastrecord = peek('record_number_max', 0);
      DROP TABLE tt_max_record_number;


      let vLastrecord = 0; // If no incremental reload, all records need to be read = PSRRNO > 0

      end if


      LOAD * ;

      SQL SELECT... ;

      The first condition 'If '$(vInputIncremental)' = 'yes' then' should be expanded with 'and transactions_$(vYear).qvd exists' but how do you write this in QV ?