Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Name | Age | Address |
John | 36 | New York |
Tom | 42 | Detroit |
Henry | 45 | Washington |
Name | ChildNames | ChildAge | ChildGender |
John | Harry | 3 | M |
John | Shawn | 5 | M |
Tom | Paul | 12 | M |
Tom | Jerry | 10 | M |
Tom | Samantha | 7 | F |
Henry | Claire | 11 | F |
You may try something like this:
TAB1:
LOAD Name,
Age,
Address
FROM
FOR i = 0 to NoOfRows('TAB1') - 1
LET vNameEntry = Peek('Name', i, 'TAB1');
TAB2:
LOAD Name,
ChildNames,
ChildAge,
ChildGender
FROM
NEXT
Before resorting to VBScript FOR loops (often much slower than native QlikView statements), try this instead of the current TAB2 code:
TAB2:
LEFT KEEP (TAB1)
LOAD Name,
ChildNames,
ChildAge,
ChildGender
FROM
If you run into trouble (the LEFT KEEP may not like the wildcard), you can first load all files into a single RESIDENT table using the wildcard character, and then LEFT KEEP that table to TAB1. The associations will be maintainbed and no tables will be JOINed.
Best,
Peter
You may try something like this:
TAB1:
LOAD Name,
Age,
Address
FROM
FOR i = 0 to NoOfRows('TAB1') - 1
LET vNameEntry = Peek('Name', i, 'TAB1');
TAB2:
LOAD Name,
ChildNames,
ChildAge,
ChildGender
FROM
NEXT
Thanks Oscar. This works like a charm. I have a quick question. If *Family.csv does not have Name column. Then how is it possible to add Name column using vNameEntry.
LOAD $(vNameEntry) as Name
This does not work as it tries to LOAD Henry as Name, i.e., tries to find Henry column in TAB2.
Thanks
Rahul
You would wrap the variable in single quotes:
LOAD '$(vNameEntry)' as Name,
...
...
...
Thanks Peter.
Thanks Oscar.