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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Edi1
Contributor
Contributor

Error with syntax... boolean to string error

Hello,

Please help me with this syntax.

 

This one cannot convert from boolean to string:

(row1.Cost_Center.equals("Cost Center")||row1.Cost_Center.equals("Work Breakdown Center")||row1.Cost_Center.equals("Network Center")) 

 

 

This syntax is not working:

String.valueOf(row1.Cost_Center.equals("Cost Center")||row1.Cost_Center.equals("Work Breakdown Center")||row1.Cost_Center.equals("Network Center")) 

 

 

The input schema is a String. Output schema is a String

 

one of the cost centers. it can be Cost Center, Work Breakdown Center, or Network Center 

Labels (2)
1 Solution

Accepted Solutions
9 Replies
gjeremy1617088143

Hi as i see if it’s in a tmap Column: it’s because you only have the condition, there is no value set where condition is reached or not. So talend read it as a boolean

gjeremy1617088143

If you want to filter the cost center That respect only Your condition put Your sentence in the filter expression editor of your input. And invert string position to make it null safe (ex: "Cost Center".equals(row1.Cost_Center) instead of row1.Cost_Center.equals("Cost Center") )

Edi1
Contributor
Contributor
Author

Ok, I will try to see how this format works. Thanks gjeremy!

Edi1
Contributor
Contributor
Author

@gjeremy,

 

It looks better but not good since it is now giving output of all false. Do you know what I can change here?

 

String.valueOf("Cost Center".equals(row1.Cost_Center)||"Work Breakdown Center".equals(row1.Cost_Center)||"Network Center".equals(row1.Cost_Center))

 

The output is to be a valid cost center number or nothing.

gjeremy1617088143

0695b00000Duy7LAAR.png0695b00000Duy7GAAR.png0695b00000Duy7BAAR.png0695b00000Duy76AAB.png

gjeremy1617088143

as you can see Center is not in the filter so i'll not be in the output

Edi1
Contributor
Contributor
Author

Ok, Thanks, I will look into it today.

Edi1
Contributor
Contributor
Author

@guenneguez jeremy​ 

 

Thanks gjeremy! 😂 Solved. It was just row1.Cost Center (no space)

Edi1
Contributor
Contributor
Author

Your posts were extremely helpful @guenneguez jeremy​