[resolved] tmap / tfilter and float

One Star MNP
One Star

[resolved] tmap / tfilter and float

Hi,
Im am trying to filter on my column "Account_number" which is type float(10,2).
I then in the tfilter add "Account_number" as inputColumn, function is empty, operator is "Equals" and value 30000 as that is the number I would like to filter upon.
I then get the error "The method compareTo(Float) in the type Float is not applicable for the arguments (int).
What am I doing wrong?

Accepted Solutions
Community Manager

Re: [resolved] tmap / tfilter and float

Hi
You can filter the rows on tMap, please see my screenshot.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
Moderator

Re: [resolved] tmap / tfilter and float

Hi,
Could you please elaborate your case with an example with input and expected output values? As we known that you cannot compare two different data type. The expression should be: compareTo(String anotherString)

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

Re: [resolved] tmap / tfilter and float

Hi,
What I would like to do is that I would like an interval of accounts between 30000 and 30900 to be mapped as "Revenue" and all other accounts to be mapped as "Costs".
Meaning I have a charts of accounts table where the accounts go from 30000 to 79000, I would then like to split them into two - a revenue part (30000 to 30900) and Costs (the rest of the accounts).
My idea was to either use the tfilter to split accounts into two - or use the tmap and to the same while adding a new column on the two outputs stating either "Revenue" or "Costs". But then I get the problem that I have the accounts in the format float, but it seems like the tfilter would like them to be integer.
Can I get around that somehow?
Best regards
Morten
Community Manager

Re: [resolved] tmap / tfilter and float

Hi
You can filter the rows on tMap, please see my screenshot.
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star MNP
One Star

Re: [resolved] tmap / tfilter and float

That works great, thanks a lot
Seven Stars

Re: [resolved] tmap / tfilter and float

You need to ensure that the fixed value you're comparing to is the same type as your column. 30000 is treated by Java as an int but your column is a float, so instead you should use the fixed float value 30000f.

Re: [resolved] tmap / tfilter and float

i have genric filter( emp_id=5 ). I can do the same filtering in tmap and tfilter also. But which is prefered in filtering and why?
Community Manager

Re: [resolved] tmap / tfilter and float

i have genric filter( emp_id=5 ). I can do the same filtering in tmap and tfilter also. But which is prefered in filtering and why?

If you just only want to filter data, use tfilterrow, if you still need to do other processing like minus/add columns, use tmap.

Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

Re: [resolved] tmap / tfilter and float

I understand that, what is the difference if we use filter in tfilter and tmap..Please share your thoughts
Seven Stars

Re: [resolved] tmap / tfilter and float

If you use the advanced mode of tFilterRow, your filter expression is used in the code exactly as written. There is then no difference to the filtering that tMap would do, which also uses the filter expression exactly as written. However, tMap has a lot more overhead as it can do so much more than just filter rows.
If you use the normal mode in tFilterRow, the settings you choose are translated into a Java expression in the code that might not be the same as if you had written it yourself. The difference in that case will depend on which expression is more efficient and appropriate to your purpose.