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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Filter: string / integer

Hello,
I want to test the values of a field (ACBAC) in a tmap component:
row1.PFUNCO==4?StringHandling.LEFT(StringHandling.TRIM(row1.PFPN),8)+"/"+StringHandling.TRIM(row1.PFUNCO) 0683p000009M9p6.pngtringHandling.TRIM(row1.PFPN)+"/"+StringHandling.TRIM(row1.PFUNCO)
currently it does not work!
It is strange because when I check the data type, ACBAC is an integer and when I test as an integer I get the following error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Incompatible operand types String and int
When I test it as a string I don't have the error:
Starting job ArticlesUCv2 at 08:12 10/06/2009.
connecting to socket on port 3463
connected
disconnected
Job ArticlesUCv2 ended at 08:12 10/06/2009.
but it does always the "else" part of the condition.
example of the output data:
15366M0500/881 PPE MAZOUT AS47A 4
15366M0545/881 PPE MAZOUT AS47A +CABLE 4
15366P0500/K10 PPE MAZOUT AS47A 4
15366P0500/111 PPE MAZOUT AS47A 4
15366P0500/121 PPE MAZOUT AS47A 4

as you see I have ACBAC=4 and it does not extract the left part of the firts field
Any ideas how to debug it?
Thanks
Didier
Labels (3)
4 Replies
Anonymous
Not applicable
Author

new attached screenshot
Anonymous
Not applicable
Author

screenshot
Anonymous
Not applicable
Author

Hello
, ACBAC is an integer and when I test as an integer I get the following error:

ACBAC is an integer, but you set a string to it, so it will throws this exception.
as you see I have ACBAC=4 and it does not extract the left part of the firts field

From your result, I see this is one of records of PFUNCO:
881 PPE MAZOUT AS47A 4
Only the last char is 4, why don't you say 'I have ACBAC=4', you need get the last char and set it as condition.
Aslo, if the data type of ACBAC is string, you should define the expression as:
row1.PFUNCO.equals("xxx")?StringHandling.LEFT(StringHandling.TRIM(row1.PFPN),8)+"/"+StringHandling.TRIM(row1.PFUNCO) 0683p000009M9p6.pngtringHandling.TRIM(row1.PFPN)+"/"+StringHandling.TRIM(row1.PFUNCO)
Anonymous
Not applicable
Author

Hi Shong,
Thanks for your recommandations
I have found my misstake
Didier