I'm wondering how the Qlikview community would approach the following puzzle. I have a working solution, but it is not elegant by any means.
I have two tables outlined below, table1 and table2. I want to create a single table that looks like table3.
The field id is a made up identifier for this example. num only appears on table1. bnum only appears for colors equal to blue. The only color in table2 is blue. letter sometimes exist in table1, but then only for color equal red. letter exists for each record in table2.
Effectively, table3 should contain all records from table1, add records from table2, and fill in letter where it exists.
TempTable: LOAD id, num, bnum, color, letter FROM (biff, embedded labels, table is Table1$);
Table2: OUTER JOIN LOAD id , num as num2, bnum as bnum2, color as color2, letter as letter2 FROM (biff, embedded labels, table is Table2$);
Table3: LOAD id, If (len(trim(num)) <> 0, num, num2) as num, If (len(trim(bnum)) <> 0, bnum, bnum2) as bnum, If (len(trim(color)) <> 0, color, color2) as color, If (len(trim(letter)) <> 0, letter, letter2) as letter Resident TempTable ;