5 Replies Latest reply: Sep 16, 2014 4:39 AM by Ralf Schwill RSS

    How to prevent loading the same file twice

      Hi,

      I'm working on a Stock analysis tool for my first qlikview project.

      The only issue I'm struggling with is to prevent the script from importing the same "changed_stock.csv" more often than once.

      Could you please give me an advice how to solve this?

      I thought about deleting the file after import, or adding an unique id to the csv and import with a where not exists.

       

      //Loading price table
      LOAD @1 as ArtNr,
           @2 as ArtikelBezeichnung,
           @7 as Bewertungspreis,
           @8 as PEinheit
      FROM
      [\\s-m3qv\flatfiles$\CSB\Preise 2013.xls]
      (biff, no labels, header is 9 lines, table is [Preise 2013$]);
      
      //Loading Stock table including historical data
      Stock:
      LOAD ArtNr,
           LosNr,
           Lager,
           Datum,
           Menge,
           Einheit
      FROM
      [\\*****\Stock.qvd]
      (qvd);
      
      //Loading changed Stock data into the Stock table
      StockIncremenal:
      Concatenate
      LOAD [Art.-Nr.] as ArtNr,
           LosNr,
           Lager,
           Datum,
           Menge,
           Einheit,
           MHD
      FROM
      [\\*****\stock_changed.csv]
      (txt, codepage is 1252, embedded labels, delimiter is ';')
      ;
      
      //overwrite the stock qvd with the merged data
      Store Stock into '\\*****\Stock.qvd' (qvd);
      
      

       

      Kind Regards