filter data using tMap

One Star

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!
One Star

Re: filter data using tMap

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

Re: filter data using tMap

It's a java matter. With java strings you must use row.ITEM.equals()
One Star mpa
One Star

Re: filter data using tMap

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
One Star

Re: filter data using tMap

it's working! Thanks!!!
One Star

Re: filter data using tMap

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!
Employee

Re: filter data using tMap

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

Re: filter data using tMap

You can use !row3.Item.matches("Apple|Dell").
One Star

Re: filter data using tMap

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
Moderator

Re: filter data using tMap

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
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: filter data using tMap

Hi thanks for the help
The idea was to pull the data from Oracle then stage it in SQL so I could build a history outside the transactional system? then send all Fixed income portfolios to one output and Equity portfolios to another.. Eventually when I get the output working it will go to an FTP site at Bloomberg?s.
Herewith are the screen shot
The area I'm struggling is apply a filter to the outbound data that acts like a where clause on the ENTITY ID. if i remove any filters all the data flows through so its not the workflow that's the issue, just the filter
the screen shot shows one output with no filter and one with...
my data and names are 100% so it must be something in my filter syntax
One Star

Re: filter data using tMap

Hi thanks for the help
The idea was to pull the data from Oracle then stage it in SQL so I could build a history outside the transactional system? then send all Fixed income portfolios to one output and Equity portfolios to another.. Eventually when I get the output working it will go to an FTP site at Bloomberg?s.
Herewith are the screen shot
The area I'm struggling is apply a filter to the outbound data that acts like a where clause on the ENTITY ID. if i remove any filters all the data flows through so its not the workflow that's the issue, just the filter
the screen shot shows one output with no filter and one with...
my data and names are 100% so it must be something in my filter syntax
Moderator

Re: filter data using tMap

Hi,
Herewith are the screen shot
The area I'm struggling is apply a filter to the outbound data that acts like a where clause on the ENTITY ID. if i remove any filters all the data flows through so its not the workflow that's the issue, just the filter
the screen shot shows one output with no filter and one with...
my data and names are 100% so it must be something in my filter syntax

It seems the screenshot is missing, could you please check it?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: filter data using tMap

sorry, updated above
Moderator

Re: filter data using tMap

Hi,
I don't find there is error in your code.
Please make sure that the property of "Catch output reject" is false in your tmap editor.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: filter data using tMap

Hi Sabrina, yes it is set to FALSE.. also tried TRUE and also toggled the inner join around but i don't get any data no matter what the settings.. really weird...
if i put Not (!) in front of the code i get all the data but for some reason it doesn't resolve the value in Entity ID and filter on it...
values work fine as SQL statement from the SQL server
Moderator

Re: filter data using tMap

Hi,
if i put Not (!) in front of the code i get all the data but for some reason it doesn't resolve the value in Entity ID and filter on it...

Is there any extra space/symbol in string "PBNDQ" in your ENTITY_ID, which make the tmap filter failure.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: filter data using tMap

nope i have checked the data string and tried with a space, i have also tried CAPS and smalls... when the data runs through without the filter i have check that it has no spaces and C&P it back into the filter but still nothing...
is there a way to debug this?
Moderator

Re: filter data using tMap

Hi,
There is a "Debug Run"section in job view. I have a demo job as yours but everything is OK with me. Is there a good new when re-create a job(empty anything and restart), maybe there is something wrong with old one, please take a try.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.