Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

schneider2037
New Contributor III

Concatenate a Resident Load Table to Itself?

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;

1 Solution

Accepted Solutions
tripatirao
Contributor II

Re: Concatenate a Resident Load Table to Itself?

Yes,

Please check in your script  the table Boss_Units_TEMP should be loaded previously.

Here some new fields are adding to BOSS table and finally the fields are concatenating to Boss_Units_TEMP.


12 Replies
tripatirao
Contributor II

Re: Concatenate a Resident Load Table to Itself?

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.

schneider2037
New Contributor III

Re: Concatenate a Resident Load Table to Itself?

Thanks Tripati - so it would be logical to see somewhere earlier in the script...a table that actually gets created called Boss_Units_TEMP? That's where I'm lost, as there is nothing that I see that creates that table other than right at this moment in the script.

Thanks!!! I very much appreciate your time on this.

stigchel
Honored Contributor

Re: Concatenate a Resident Load Table to Itself?

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?

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

tripatirao
Contributor II

Re: Concatenate a Resident Load Table to Itself?

Yes,

Please check in your script  the table Boss_Units_TEMP should be loaded previously.

Here some new fields are adding to BOSS table and finally the fields are concatenating to Boss_Units_TEMP.


Re: Concatenate a Resident Load Table to Itself?

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...

schneider2037
New Contributor III

Re: Concatenate a Resident Load Table to Itself?

Thanks! Hadn't thought of that angle. Will test. Right now, just tried to reload the whole shooting match and all sorts of errors flying around. This is a very buggy script I've inherited.


Will mark as closed/answered for now. Methinks I'm going to be spending tens of hours trying to debug from top to bottom first!

Thanks again,
Jonathan

Re: Concatenate a Resident Load Table to Itself?

No, that was just wishful thinking. It doesn't work like that, not in QV11.20 nor in 12.xx.

Your table Boss_Units_TEMP must exist before this script will run till the end. On condition that the script doesn't mess with ErrorMode...

schneider2037
New Contributor III

Re: Concatenate a Resident Load Table to Itself?

Drat. That actually made sense to me logically!

Will hunt around. As you (and other folks) indicate: it has to be there either explicitly or implicitly earlier in the script process.


Thanks!

Jonathan

Community Browser