Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
AWS Degraded - You may experience Community slowness, timeouts, or trouble accessing: LATEST HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Question on tmap to use Or condition in join

Hi,
I would like to use or condition tmap while joining with a lookup table. Can anyone share how that can be done? Below, i have given the table structure and join query. I want to achieve join query using tmap. How can i do that?
Table A (Main Table)
----------
Name,
Id_1,
Id_2
Table B (Lookup Table)
------------
Table B (Lookup)
------------------
Id,
Address,
Region
SELECT A.NAME, B.ADDRESS, B.REGION
FROM A, B
WHERE A.ID_1 = B.ID OR A.ID_2 = B.ID
Labels (2)
8 Replies
alevy
Specialist
Specialist

The best way, I think, is to have two left-join lookups from Table B with an appropriate condition on your output e.g. Lookup1.Address != null || Lookup2.Address != null
Anonymous
Not applicable

Hi sree,
To make you clear, I have designed a demo job with troubleshoots.
Here are two files
1(main)
id;id1
12;24
13;26
15;30
2(lookUP)
id;name;address;region
12;dan;uk;LD
26;petter;uk;SF
15;merry;US;NY
24;shong;china;hn
60;sabrina;china;bj
The work flow is : tFileInputDelimited-->tMap-->tLogrow
Please see the screenshots for details

Best regards
Sabrina
0683p000009MENH.png 0683p000009ME4J.png
_AnonymousUser
Specialist III
Specialist III
Author

Thanks for the replies. I will try and let you know if there are more questions.
Anonymous
Not applicable

 
What if 
 table 1 consis of ID and Name and Table two Consist of ID1, ID2 and Table 1 is main in tmap and Table 2 is Lookup 
. how to sort this out?? @xdshi

 

manodwhb
Champion II
Champion II

Try this way.

row1.id==row2.id1 || row1.id==row2.id2
Anonymous
Not applicable

Thank You So much @manodwhb

It works very well.

Prasanna3
Contributor
Contributor

If any column having null data then will get nullpointer exception right?
jeoste
Creator II
Creator II

Does this example still works ? I tried the same job, with same data and components. I can read the data in input, from the tFileInputDelimited, but my output is empty ; it looks like the join / condition does not work.

Any ideas ? 0683p000009MACn.png