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

How to link these two tables?

Hi

I have two tables of the following configuration:

Table1:

Key1, Dim1, Dim2, Dim3, Key2, Dim4, Dim5, Dim6

123  , A     , B      , C     , 345  , D     , E      , F

678  , G     , H      , I      , 912  , J      , K      , L

Table2:

Key1, Key2, Dim7

123  , -       , AA

-      , 345   , BB

678  , -       , CC

-      , 912   , DD

If 123 is selected in Table1 Table 2 should show the first and second row. The same if 345 is selected.

Is there any way to do this through mapping?

Kind Regards

Daniel

8 Replies
vinieme12
Champion III
Champion III

that should be naturally happening without the need to do anything

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

can you post a better sample with a bit more clarity on what you are trying to achieve?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Sergey_Shuklin
Specialist
Specialist

Hello, Daniel!

Try to separate Table2 by two different tables. One will contain a Key1 and the second will contain Key2. The Table1 will be main, so when you select a 123 in Key1 field it will show you result as two rows 123-AA (Table2 with Key1) and 345-BB (Table3 with Key2).

Not applicable
Author

Hi Sergin

Thank you for the reply. Unfortunately all the data in Dim7 needs to be in the same column. It contains GeoData which I want to use in a QlikMaps plugin.

Any other ideas?

Kind Regards

Daniel

Not applicable
Author

Yes. But the the condition

If 123 is selected in Table1 Table 2 should show the first and second row. The same if 345 is selected.

won't be fulfilled.

Kind Regards

Daniel

vinieme12
Champion III
Champion III

is this exactly how your source data is or are you creating any of these tables yourself?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
vinieme12
Champion III
Champion III

try below

Table1:

load * Inline [

Key1, Dim1, Dim2, Dim3, Key2, Dim4, Dim5, Dim6

123  , A     , B      , C     , 345  , D     , E      , F

678  , G     , H      , I      , 912  , J      , K      , L

];

temp:

load RecNo() as Rowkey,Key1,if(len(Key1)<2,Peek(Key1),Key1) as KeyA,

Key2,

Dim7

inline [

Key1, Key2, Dim7

123,, AA

,345, BB

678,,CC

,912,DD

];

NoConcatenate

LOAD

Rowkey,

KeyA as Key1

,KeyB as Key2

,Dim7;

LOAD

Rowkey,

KeyA,

Key2,

if(len(Key2)<2,peek(Key2),Key2) as KeyB,

Dim7

RESIDENT temp

Order by Rowkey DESC;

DROP table temp;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Not applicable
Author

I solved it utilizing another key. Thanks for all the answers anyway.

Kind Regards

Daniel