Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm new with Qlik, and I'm trying to understand the way Qlik works with concatenations.
I know it is a quite strange and nonsense example, but it is just for testing and studying:
I have an Inline table like this:
MESES:
LOAD * Inline
[mes
ene.
feb.
mar.
abr.
];
And I'm trying to understand why this:
MESES_2:
LOAD *;
LOAD * Resident MESES;
concatenate
LOAD *,
RowNo() as rnb
Resident MESES;
Does not through the same result as this:
MESES_2:
LOAD *;
concatenate (MESES) LOAD *,
RowNo() as rnb
Resident MESES;
I though that putting the table name "MESES" in parenthesis is the same as telling Qlik to take the Resident table "MESES" and concatenate it with (in this case) itselve.
Thank you!
My understanding is the Concatenate requirement breaks the chain of preceding loads. See e.g.
https://community.qlik.com/t5/QlikView-App-Dev/load-doesn-t-work-on-concatenated-tables/td-p/1199024
In any case, I strongly advise against this sort of writing. Nesting preceding loads is almost always a bad idea, because even if it works, it's very hard to read. Using resident loads is much better.
This example doesn't make any sense, as you said...
In the first case you are loading four months, then you are loading the same four months into the same table (two tables with the exact same fields are automatically concatenated by Qlik), then you are loading the ensuing eight lines and adding a field. The first Load * doesn't even do anything since you're doing a preceding Load * from the same Load *. MESES2 is not created because the first set of loads was automatically concatenated to MESES, and the second one is implicitly concatenated to MESES because it's the previous table.
In the second case, you're using a preceding Load * on a version of MESES to which you've already concatenated the extra field, so you're getting four lines total, matching the original number. Because the list of fields in this table isn't identical to MESES, the tables aren't automatically concatenated and MESES2 is created.
In the second case,
Thank you Or,
you said "In the second case, you're using a preceding Load * on a version of MESES to which you've already concatenated the extra field, so you're getting four lines total"
Why four lines? I have 4 lines in MESES, then I concatenate it whit itselve but adding an extra field, so shouldn't it result in 8 lines?
You aren't concatenating it with itself, because of the added preceding load. If you remove that, you'd get eight lines in the original table but this way you get four lines in a new MESES2.
Thank you again,
I though that when using "preceding Load" in Qlik it works from bottom to top, so in my example, shouldn't it execute the code from the "conatenate" keyword and obtain 8 lines, and then add the "LOAD *;" at the top? And shouldn't the LOAD * just load all the data behind it, (8 lines)?
Thank you for your patience with me...
My understanding is the Concatenate requirement breaks the chain of preceding loads. See e.g.
https://community.qlik.com/t5/QlikView-App-Dev/load-doesn-t-work-on-concatenated-tables/td-p/1199024
In any case, I strongly advise against this sort of writing. Nesting preceding loads is almost always a bad idea, because even if it works, it's very hard to read. Using resident loads is much better.
Thank you Or.