Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
till_bentz
New Contributor III

Bug or misunderstanding?

Hello,

I have question regarding the automatic concatenation of tables in QlikView.

Say we have the following code in a load script:

Table1_temp:

LOAD Value, Date;

SQL SELECT * FROM database;

Table1:

LOAD Value, Date Resident Table1_temp Order By Date asc;

DROP Table Table1_temp;

I had initially assumed that this would result in one Table1 with its records sorted by Date.

It turned out, that I was wrong. QlikView automatically concatenates the two tables into one Table called Table1_temp. This Table contains all records in the original order followed by the records ordered by Date.

It took some time to find my error. My question is:

Is this a bug? I would expect this behavior if I hadn't defined a new name for the table...

What do you think?

Just to clarify this post. I know how to avoid this behavior. I was just wondering, if I am the only one who expected it to be different

Regards

Till

Nachricht geändert durch Till Bentz

Tags (2)
1 Solution

Accepted Solutions
Employee
Employee

Re: Bug or misunderstanding?

Hi Till.

This is the expected behavior according to the Reference Manual and not a bug.

From the Reference Manual:

Each load or select statement generates a table. Normally, QlikView treats the result of each one of these as

one logical table. However, there are a couple of exceptions from this rule:

- If two or more statements result in tables with identical field names, the tables are concatenated and

treated as one logical table.

The NoConcatenate prefix forces two loaded tables with identical field sets to be treated as two separate

internal tables, when they otherwise would be automatically be concatenated.

I hope it helps,

Carlos

16 Replies

Re: Bug or misunderstanding?

It is a normal behaviour, to avoid use noconcatenate:

Table1_temp:

LOAD Value, Date;

SQL SELECT * FROM database;

Table1:

noconcatenate

LOAD Value, Date Resident Table1_temp Order By Date asc;

DROP Table Table1_temp;

hope it helps

Re: Bug or misunderstanding?

Hi

Try below code

Table1_temp:

LOAD Value, Date;

SQL SELECT * FROM database;

no concatenate

Table1:

LOAD Value, Date Resident Table1_temp Order By Date asc;

DROP Table Table1_temp;


Regards

ASHFAQ

till_bentz
New Contributor III

Re: Bug or misunderstanding?

Hello,

thanks. I know it seems to be normal behavior. I also found the solution you suggested. But I still think it is at least confusing.

I purposefully assigned a new name to the table so I would expect, that it would not be concatenated automatically...

Luminary
Luminary

Re: Bug or misunderstanding?

Why should QlikView change the name of an existing table and redefine it? I would expect the behaviour to be the other way around.. once a table has been loaded, check if there's already a loaded table with the same fields. If yes, concatenate, if not, create a different table.

till_bentz
New Contributor III

Re: Re: Bug or misunderstanding?

QlikView should "change" the name because I gave it the instruction to do so by adding Table1: in front of the Load statement (at least that is my understanding of the code )

If I want to concatenate it to an existing table with the same fields, I wouldn't define a name for it...

Re: Bug or misunderstanding?

Even with a new name for the table qlik will concatenate, this because the fields list is the same, if you add another field in the second table this will not happen anymore

Not applicable

Re: Bug or misunderstanding?

Hello,also  in this way, renaming the field in the 2nd load should not concatenate


Table1_temp:

LOAD Value, Date;

SQL SELECT * FROM database;

Table1:

LOAD Value, Date as NewDate Resident Table1_temp Order By Date asc;

DROP Table Table1_temp;

Re: Bug or misunderstanding?

Try to load like

Table1_temp:

LOAD Value, Date;

SQL SELECT * FROM database;

Noconcatenate

Table1:

LOAD Value, Date Resident Table1_temp Order By Date asc;

DROP Table Table1_temp;


Or


Try to add a dummy field like 1 as Value then the situation different

Table1_temp:

LOAD Value, Date;

SQL SELECT * FROM database;

Table1:

LOAD Value, Date, 1 as Value Resident Table1_temp Order By Date asc;

DROP Table Table1_temp;


Normally when we load a table from any table as resident if there is same field name qlikview refers the previous table name and for new table it creates newname try to rename the field or you can use Noconcatenate then see the difference.


Hope this helps

Luminary
Luminary

Re: Re: Bug or misunderstanding?

That's true - the concatenation is being done automatically because if not, then you'll get a fantastic synthetic key containing a mix of all fields at the end (which would eventually crash at the end of the load).