Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
 till_bentz
		
			till_bentz
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
 
					
				
		
It is the expected behavior.
When you load a table with the exactly the same set of fields as a previously loaded table, it is auto-concatenated to the previously loaded table. It doesn't matter if you assign a ne label or not, or if there is a label at all. It doesn't matter when the first table was loaded - just before the second, or way before. The set of fields is only what matters.
As others has said, you can use NOCONCATENATE to avoid this.
In your case, you can use order in the first table.
 
					
				
		
 till_bentz
		
			till_bentz
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		How can I order the first table? Whenever I tried to order directly in preceding loads I got errors with non existing fields or something like that...
 
					
				
		
I don't think it works in the preceding load. This is what I mean:
Table1_temp:
LOAD Value, Date;
SQL SELECT Value, Date FROM database
ORDER BY Date;
Wondering why do you need order. Are you using it further in the script?
 
					
				
		
Table1_temp:
LOAD Value, Date;
SQL SELECT * FROM DATABASE order by Date asc;
.png) 
					
				
		
.png) cfz
		
			cfz
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
 
					
				
		
 till_bentz
		
			till_bentz
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thanks.
Unfortunately I can't use the order by on SQL level, because in my real application I already have several preceding loads.
And yes, I need the order, because later on I rely on them being ordered by date to find specific values.
 
					
				
		
 till_bentz
		
			till_bentz
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thank you!
I guess what I would have expected is, that naming a table would result in an implicit NoConcatenate...
Especially when you have long load scripts this might save you from confusions during development...
