4 Replies Latest reply: Sep 13, 2016 12:34 PM by Chad Erickson RSS

    Update a resident table

    Chad Erickson

      I have a qvw that loads daily qvd's. I would like for it to just add one day everyday rather than reload the entire period of time. Currently it reloads the last two weeks worth of individual qvd's. I attempted to do an add load, but that didn't work. Any help is appreciated.

        • Re: Update a resident table
          Sunny Talwar

          What is the script you are using right now?

            • Re: Update a resident table
              Chad Erickson

              This is a simplified version of it.

               

              FOR i = today()-15 to today()-1

              LET FILE_Date = date($(i),'yyyyMMdd');

               

              T1:

              LOAD date, A, B, C

              FROM QVD1$(FILE_Date).qvd

              ;

               

              T2

              LOAD date, A, B, D

              FROM QVD2$(FILE_Date).qvd

              ;

               

              NEXT i;

                • Re: Update a resident table
                  Peter Cammaert

                  Try like this (just some steps that can be easily translated into QV script):

                   

                  1. Load History QVD (if it exists)
                  2. Pick latest date from history file or set latest date to some "first" date if no history
                  3. For vDay = LatestDateFromHistory + 1 to Today()
                  4.    Assemble correct file name based on vDay value
                  5.    Add records from this QVD to resident table
                  6. Next
                  7. Store resident table into history QVD

                   

                  If you don't drop the resident table at the end, you'll have an updated internal table, whether you script runs every day or not (fail safe)

                   

                  Best,

                   

                  Peter

                    • Re: Update a resident table
                      Chad Erickson

                      How would I do that in the script. Particularly your Step 5. I have been throw right into Qlikview and not very familiar with it. I am looking at just updating the internal table so I don't have to create more QVDs. The daily QVD is created every night for the day just ending so it is always a day behind, then this report runs after the latest QVD has been created. I tried ADD LOAD, but when I ran it, it overwrote the historic data and only added yesterday.