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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

filter data using tMap

I'd like to ask if I can do the following by using tMap. I just tried and it didn't work. I don't know if it is correct on the logic side.
I'd like to get data from the database and filter out the data using a tMap and get the output.
I used the design as follows(shown in pic):
tOracleInput - row(Main) - tMap - out1 - tLogRow
- out2 - tLogRow
There are two outputs, which means I want to filter out the data using two conditions. (as shown in the pic)
I put the condition in the expression filter. But nothing returns in the end.
I hope anyone could give me advice if my idea works. Really appreciate that!
Thanks!
Labels (2)
18 Replies
Anonymous
Not applicable
Author

One more thing I tried to reproduce the case. So the row3 and row4 doesn't matter. In my case, it matches.
Thanks!
Anonymous
Not applicable
Author

It's a java matter. With java strings you must use row.ITEM.equals()
Anonymous
Not applicable
Author

Hi,
As giuseppecalogeropicone said in talend you cannot use "==" for string but you must use the equals function to compare strings.
Change it to: row3.item.equals("DELL COMPUTER")
Regards
Anonymous
Not applicable
Author

it's working! Thanks!!!
Anonymous
Not applicable
Author

Then if I want to compare to several string, how to change the expression?
like I want all items are not apple, dell computer. How to put that string in a easier way?
!row3.Item.equals("Apple") and !row3.Item.equals("Dell")
Also, do I need the double quote if it's a integer?
row3.id.equals(20) or row3.id.equals("20")
thanks!
Anonymous
Not applicable
Author

Hi,
You can replace the and by && and the or by ||, for an integer you would use row3.id == 20
alevy
Specialist
Specialist

You can use !row3.Item.matches("Apple|Dell").
Anonymous
Not applicable
Author

can get this filter to work on a string. i coded BB.ENTITY_ID.equals("PBNDQ") in the expression filter but i get no output... i can see may data is correct as i put a SQL Database in between the Oracle call and the data is correct in SQL.. if i remove the expression filter it run through to Excel, so its just around the code in the expression filter that i seem to be stuck
Anonymous
Not applicable
Author

Hi andrew.vanosch,
What's your current situation? job workflow? Could you elaborate your case with an example with input and expected output values so that we can take a testing for that and give an accurate solution.
Best regards
Sabrina