Hi All,
This may seem obvious but what does the scripting term 'Resident' actually do. I've seen it in many scripts but I've not been able to work out what it's actually for.
Thanks
MV
You may want to reload that set of data to use an aggregation table or to concatenate to other tables or to join or to use qlik native instruction instead of the database instruction ...
LOads data yet loaded and actually resident in memory
It is used when fetching data from a table that is already loaded
A table that has been loaded in the script can be accessed using a Load ... resident statement in the script.
Resident is used if data should be loaded from a previously loaded table. Table label is a label preceding the load or select statement(s) that created the original table. The label should be given with a colon at the end.
Tab1:
Load
Field1,
Field2,
....
From <DataSource>;
Tab2:
Noconcatenate
Load
Field1,
Field2,
If(Field1=Field2, 'Yes', 'No') As Flag
Resident Tab1;
Drop Table Tab1;
Why would you want to re-load data that you've already loaded ? Surely, once data has been loaded into a QV table then it stays loaded ??
Confused
You may want to reload that set of data to use an aggregation table or to concatenate to other tables or to join or to use qlik native instruction instead of the database instruction ...
This really isn't helpful. If all you can suggest is researching other knowledge sources then you shouldn't bother. I've asked this question because I haven't been able to find an answer I fully understand. I did look it up in the Reference Manual but my general ignorance of QV was insufficient to comprehend the definition.
If we all did what you suggest then there'd really be no point of a Community forum. Remember, not all of us are techies.
A good example where resident is used is when using interval match
OrderLog will be your 1st table name, it contains Start and End times (Range)
EventLog will be the 2nd table, it contains actual event times (Actuals)
Now to match the event times in the 2nd table with the start and end times in the 1st table we use the intervalmatch function, but instead of reloading the data from the source again, we point to the existing data in the OrderLog table using the Resident command instead
OrderLog:
LOAD * INLINE [
Start, End, Order
01:00, 03:35, A
02:30, 07:58, B
03:04, 10:27, C
07:23, 11:43, D
];
EventLog:
LOAD * INLINE [
Time, Event, Comment
00:00, 0, Start of shift 1
01:18, 1, Line stop
02:23, 2, Line restart 50%
04:15, 3, Line speed 100%
08:00, 4, Start of shift 2
11:43, 5, End of production
];
IntervalMatch (Time)
LOAD Start,
End
Resident OrderLog;
That's a good example and a great help. Thanks very much.
MV