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: 
Rahul_Gijare
Contributor
Contributor

Issue with intermediate variables in tMAP

Hi Team,

I am a newbee to Talend community. I have  created a following job

 

row2

inputfiledelimited_1 (Customer) Lookup to tmap

 

                                                                                                        tmap                                tlogrow

row1

Inputfiledelimited_2(Order) main to tMap

 

 

Inside tmap I am using intermediate variable to do a comparision between customer-kunnr and Order-kunnr

some how this is not working:

I have written code

row1.kunnr==row2.kunnr?true:false

 

This gives compilation error

I have attached screen shot for your referral.

 

require community help here please.

Labels (2)
1 Solution

Accepted Solutions
JR1
Creator III
Creator III

Hi

 

Have you tried to remove that second variable which has no content assigned to it? Furthermore, if you want to compare strings in Java, you will have to use the equals method of the String object (but this should not prevent a successful compilation):

row1.kunnr.equals(row2.kunnr) ? true : false

Or even simpler:

row1.kunnr.equals(row2.kunnr)

Going a bit further with this, I do not really know what you want to achieve with such a comparison and with the resulting Boolean. If you set the lookup to "Left Outer Join", only those records with a record in the lookup will have the lookup fields filled. So if you are after this flag alone, do the following:

1. Set the Join Model to "Left Outer Join" (already the case).

2. Create a new field in the output with the following value: row2.kunnr != null

This new field will then be true if there is a lookup record and false if there is none.

 

Hope this helps.

View solution in original post

3 Replies
JR1
Creator III
Creator III

Hi

 

Have you tried to remove that second variable which has no content assigned to it? Furthermore, if you want to compare strings in Java, you will have to use the equals method of the String object (but this should not prevent a successful compilation):

row1.kunnr.equals(row2.kunnr) ? true : false

Or even simpler:

row1.kunnr.equals(row2.kunnr)

Going a bit further with this, I do not really know what you want to achieve with such a comparison and with the resulting Boolean. If you set the lookup to "Left Outer Join", only those records with a record in the lookup will have the lookup fields filled. So if you are after this flag alone, do the following:

1. Set the Join Model to "Left Outer Join" (already the case).

2. Create a new field in the output with the following value: row2.kunnr != null

This new field will then be true if there is a lookup record and false if there is none.

 

Hope this helps.

Rahul_Gijare
Contributor
Contributor
Author

Thanks a lot...the issue was == instead of equals method...
Can you please ellobratewhat you mean by:
"If you set the lookup to "Left Outer Join", only those records with a record in the lookup will have the lookup fields filled. "

JR1
Creator III
Creator III

I'll try.. If you set up a lookup as a Left Outer Join, all the records from the input rows will be passed on to the output and the map tries to find a matching record in the lookup. If it does not find one, you could still pass your row2-fields in to output but they will be null. Therefore, if you do not have a match in your lookup, row2.kunnr would be null.