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

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

Problem in tMap formula : condition if ... else

Dear experts, 

 

I have an issue with this formula in my tMap :

row2.status == "PRE_TXT" ? 1 : row2.status == "TXT" ? 2 : -1

 

In fact, it's only return -1 whereas I have the values : "PRE_TXT" and "TXT" in my source field. 

 

 Many thanks. Best regards 

 

 

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

I've found the solution : 

 

row2.status.equals("PRE_TXT")?1:row2.status.equals("TXT")?2:-1 

View solution in original post

3 Replies
Anonymous
Not applicable
Author

I've found the solution : 

 

row2.status.equals("PRE_TXT")?1:row2.status.equals("TXT")?2:-1 

Anonymous
Not applicable
Author

Removed my post, as I'd made a mistake regarding Java operator precedence. Sorry.

 

Comparing the value of strings using .equals() is guaranteed to work in all cases, and that's specifically what it's designed to do.

Anonymous
Not applicable
Author

Thank you for these explanations 0683p000009MACn.png

 

Best regads