Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey guys,
Some questions regarding Loads and Resident loads.
We have a number of clients, so my plan was to in the first tab read in all data, and then load resident from that initial table in the other tabs for each specific client. But I would like to have the table named and available in the list below. Qualify is so disturbing with adding it's prefix. Anyway of doing this?
I would also like to know the difference between load resident, noconcatenate..
Hi,
If you load an inline table and then do a resident load... the table created by resident load will be merged with the inline table which you loaded earlier and you would not see your new table in table viewer. What you will see only the inline table with duplicate set of data.
However, if you use Noconcatenate before doing resident load then your new table will not be merged with the inline table but it will create synthetic keys.
Hence, If you are creating a table inline and then doing a resident load then you should drop the inline table just after resident load.
Thanks,
-Kamal
ok cool thanks. Any input on naming the table so I can choose it from the list of tables?
1. You could use a FOR EACH loop to extract data from the initial table that relates to a particular client. For example, imagine that you have clients ABC DEF and GHI, then you can add something like this to your second script tab:
FOR EACH vClient IN 'ABC', 'DEF', 'GHI'
[$(vClient)_Facts]:
NOCONCATENATE LOAD * RESIDENT InitialFacts
WHERE Client = '$(vClient)';
NEXT
You will still have to make sure that you're not creating a gigantic synthetic key because of all fields in the three tables having the same name. That's why the QUALIFY/UNQUALIFY statements were invented. They are very useful.
2. LOAD RESIDENT and NOCONCATENATE are two different things
LOAD RESIDENT is a statement that instructs the script engine to create a new table or add to an existing table and use a RESIDENT table as data source (in contrast to for example LOAD FROM).
NOCONCATENATE is a prefix that can be used with any LOAD statement to block the script engine from adding the loaded records to an existing table that looks the same (autoconcatenate)
As you can see in the first example, NOCONCATENATE and LOAD RESIDENT can be used together without any problem. In this example, we use it to force the creation of a new table during every loop although we load the exact same set of columns over and over.
Best,
Peter
That makes sense, do you know of any idea of naming the table without using qualify?
In the example, tables will be named ABC_Facts, DEF_Facts and GHI_Facts.
Feel free to modify according to your preferences.
Just supply a relevant name before Load keyword
Like:
Table1:
Load
*
Inline
[
];
noconcatenate
Table2:
Load *
resident Table1;
Cheers,
-Kamal