12 Replies Latest reply: Apr 16, 2018 10:02 AM by jonathan schneider RSS

    Concatenate a Resident Load Table to Itself?

    jonathan schneider

      Brand new to QV, and inherited a project. Trying to decipher the script yet, and have run across something I'm missing;

       

      In the script editor, there are 20+ tabs with hundreds of lines of script. While I get most, ran into this one:


      There is NO reference earlier in the script to create table "Boss_Units_TEMP", only here on a Resident load.

       

      QUESTION: How/Why would I Concatenate into the same table a Resident Load is creating? Disregard the particulars of the fields please. Just trying to wrap my brain around the logic here.

       

      Thanks all for any help/guidance. 28 days in to QV now...Jonathan

       

       

       

      Concatenate(Boss_Units_TEMP)

      Boss_Units_TEMP:

      LOAD

      KEY_StateDealer,

      PLBT,

      FQTR,

      BOOKED_YEAR as FISCAL_YEAR,

      BOOKED_YEAR &'-'& FQTR as FISCAL_KEY,

      Sum(BOOKED_UNIT) as UNIT_BOOKED,

      UNIT_FUEL_TYPE as FUEL_TYPE

       

       

      Resident Boss

       

      Group By KEY_StateDealer, UNIT_FUEL_TYPE, PLBT, FQTR, BOOKED_YEAR

      ;


      DROP Table Boss;

        • Re: Concatenate a Resident Load Table to Itself?
          tripati rajana

          Hi,

           

          the above script is adding new fields to your table Boss_Units_TEMP  table and in order to use aggr function(like sum,max, count) in the script you have to use group by clause.


          hope it helps.

           

          • Re: Concatenate a Resident Load Table to Itself?
            Piet Hein van der Stigchel

            I think QV will produce a table not found error if the table Boss_Units_TEMP does not exist. So it should be there somewhere in the script. Please note that QV will name tables to the tablename (sql) or sheetname (xls) if not explcitely named in the scipt. Other options, hidden scripts? Any Include scripts?

            • Re: Concatenate a Resident Load Table to Itself?
              Marcus Sommer

              To load resident from a table and merging the new load-results by concatenating or joining to the origin table isn't unusual for example if you need to join the max. Date from the first load for certain keys but you want to keep a different degree of granularity in this table as you calculate the Date or if you want to concatenate different granularities of certain measures maybe one on a transaction-level and the other on a monthly-level.

               

              Assigning a tablename for a load which is concatenated to another table is not correct but it will be usually ignored but a concatenate-statement to a not existing table table should AFAIK result in an error.

              Are you really sure that this table didn't exists? Maybe this table is generated within the hidden script, by an include-variable or it might be the result of a renaming (maybe by mapping-statement). Just add a exit script; before this load and take a look within the table-viewer.

               

              If this table didn't exist it could be that a different table with the same table-structure exists to which this load is added whereby like above stated I would rather expect an error if not any ERRORMODE is implemented.

               

              - Marcus

              • Re: Concatenate a Resident Load Table to Itself?
                Peter Cammaert

                Aha, this may be an interesting test case.

                 

                The QlikView Load prefix operations are executed after the LOAD itself. AFAIK they are never executed while performing the Load (like a Preceding Load is). But since the Load first creates the table to which it then tries to concatenate itself, this construct may actually work without errors.

                 

                The resulting table may have all records twice though. Can you check that ?

                Or just comment out the Concatenate line and reload. Does it produce the same results in your document?

                 

                [Edit] Sorry, spelling errors. You know...