Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Looking up info in an "unlinked" table and showing it in a Straight Table

Fellow Qliksters,

A question from a newbie.

Leaving aside the lengthy reason why, here is something I'm interesting in doing, or at least learning how it could be done although it may not be the most Qlikfriendly method. I may for example want do this as a quick patch before doing a larger overhaul of the application in question.

Imagine that I have a Straight Table that has some fields showing. I have given labels to those fields, but could also refer to them as column(1), column(2), etc.

Now imagine that in the loading script, I loaded a table that has no linkages to the rest of the tables in the application.

Now imagine that I want to get some values from that table and show those values in the applicable rows in the Straight Table. Furthermore, in order to get the right values from this "unlinked" table I want to use values from respective rows in the straight table. Essentially I want to do a SQL style query on the unlinked table and the Where clause would include the field labels (or column references) from the Straight Table.

For example,

say my straight table looks like this:

FieldX, FieldY,

1,B

4,A

then, say my unlinked table loaded into the application is as follows:

1,A,V1

1,B,V2

4,A,V3

4,B,V4

then say that I want my straight table to end up as follows:

FieldX, FieldY, FieldNew

1,B,V2

4,A,V3

Is there a way to write an expression to define FieldNew that does a SQL style lookup to the unlinked table and uses the FieldX and FieldY labels (or column references) as arguments to identify which row in the unlinked table to get a value from?

Although I am a newbie I am aware of the right way to do this (based on the above example), but I have a hard to explain scenario that is not as simplistic as the above where something like this would help me make a temporary patch until I overhaul the application.

Your help is most appreciated.

1 Reply
nagaiank
Specialist III
Specialist III

You may get the result by using a left join in the script as given below:

Tab1:

LOAD * Inline [

FieldX, FieldY

1,B

4,A

];

Tab2:

LOAD * Inline [

Fld1, Fld2, FieldNew

1,A,V1

1,B,V2

4,A,V3

4,B,V4

];

Left Join (Tab1) LOAD Fld1 as FieldX, Fld2 as FieldY, FieldNew Resident Tab2;

If this option is not possible in your applicataion (though I do not see why), you may add a combined key FieldX|FieldY in Tab2 and use Lookup() function to extract FieldNew from Tab2.

Hope this helps.