Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Smart Loading

Hello all,

I am loading data frequently from an existing table (resident) to add it slightly modified to the same table.
Typically I want to change exactly 1 field.

Example:

TabA:
LOAD
a,
b,
c
from SQL ....;

concatenate (TabA)
LOAD
a,
'Copy' as b,
c
resident TabA;

For a small number of fields this is fine, but for lots of fields, the script gets difficult to read.
There must be a smarter way .... ? (I really just want to change 1 field out of e.g. 30.)

This

LOAD
*,
'Copy' as b
resident TabA;

does not work, as field b would be twice in the load statement.

Any idea?
Thank you,
Thilo

1 Solution

Accepted Solutions
Not applicable
Author

TabA:
LOAD
a,
b,
c
from SQL ....;

TabTemp:
LOAD
*
resident TabA;

DROP FIELD b FROM TabTemp;

CONCATENATE (TabA)
LOAD

*,
'Copy' as b
resident TabTemp;

DROP TABLE TabTemp;



This should work but isn't good for the performance of your loadscript!

View solution in original post

4 Replies
Not applicable
Author


Thilo wrote:
LOAD
*,
'Copy' as b
resident TabA;
does not work, as field b would be twice in the load statement.


Try this:

TabA:
LOAD
a,
b,
c
from SQL ....;

DROP FIELD b;

LOAD
*,
'Copy' as b
resident TabA;



Not applicable
Author

Hello Sander,

Not yet ... as I want to keep the contents of b ... both from the SQL and the new load.

Simple use case:

TabA: Load 1 as Version, Value1, Value2 from SQL

concat. TabA: Load 2 as Version, Value1, Value2 resident TabA

(i.e. I copy the value data to a new version.)

Typically there is a lot of transformation code between the two statements, i.e. it is not as simple as reloading the SQL 😉

Thank you,
Thilo

Not applicable
Author

TabA:
LOAD
a,
b,
c
from SQL ....;

TabTemp:
LOAD
*
resident TabA;

DROP FIELD b FROM TabTemp;

CONCATENATE (TabA)
LOAD

*,
'Copy' as b
resident TabTemp;

DROP TABLE TabTemp;



This should work but isn't good for the performance of your loadscript!

Not applicable
Author

yep - this would work ... and you're right, the performance will suffer.

Well, there is always a trade-off ... 😉

Thank you,
Thilo