You can load directly from a file, You can load from a subsequent (following next) select or load statement, but it must follow immediately after. Can load from a previously loaded (resident) table, load directly from an inline load, or load from generated data.
A quick Inline example is
Load * Inline
[CatID, Category
0,Regular
1,Occasional
2,Permanent];
In the Load script it is possible to rename one or more fields.
Since QlikView puts a great deal of meaning into names (for associations) you should really learn these!
Load as: means rename a specific field in that specific statement.
Alias
Rename Field: Rename field XAZ0007 to Sales; (It can also use a mapping table)
Now for my oh so awesome example.
Create our favorite c:\Data.txt with notepad and type in
StupidName
1
2
3
4
5
So now our load statement would look like this (to change StupidName to BetterName)
LOAD StupidName as BetterName
FROM C:\DATA.txt (ansi, txt, delimiter is '
', embedded labels, msq);
or using Alias (Notice the Alias comes first!)
Alias StupidName as BetterAliasName;
LOAD StupidName
FROM C:\DATA.txt (ansi, txt, delimiter is '
', embedded labels, msq);
Or using rename Field (Notice the rename goes after!)
LOAD StupidName
FROM C:\DATA.txt (ansi, txt, delimiter is '
', embedded labels, msq);
rename field StupidName to aRenamedName;
And using a mapping table (Map comes first!)
MyMap:
mapping load * inline [
Old,New
'StupidName', 'aNewMappedName'
];
LOAD StupidName
FROM C:\DATA.txt (ansi, txt, delimiter is '
', embedded labels, msq);
rename fields using MyMap;
No comments:
Post a Comment