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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[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?
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi
You can filter the rows on tMap, please see my screenshot.
Shong
0683p000009MEKH.png

View solution in original post

9 Replies
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

Hi
You can filter the rows on tMap, please see my screenshot.
Shong
0683p000009MEKH.png
Anonymous
Not applicable
Author

That works great, thanks a lot
alevy
Specialist
Specialist

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.
Anonymous
Not applicable
Author

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?
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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

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.