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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
daez
Creator
Creator

Tmap conditions working in test but not when executing

Hello everyone,

 

I'm fronting something strange with my Tmap conditions.
I have one row in input; with field "State". This state is a string : "in stock", all my input "State" has this value. I want it to be in the output 1 if its "in stock" and 0 for any others values. So i created a var with expressions :

row7.State=="in stock"?"1":"0" 

named NewState, and linked it to my output " State". Before that, in the expression constructor, I did a test. I put as value " in stock" in row.7 state, clicked " Test " and it returned "1". I thought all was fine. But when I execute my job, all my state get "0".

 

How comes the Tmap Expression Builder's Test returns me the good value, but the output filed I get is false? What am I missing?

 

 

 

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

You should never use == to compare 2 strings.

Use 

"in stock".equalsIgnoreCase(row7.State) ? "1" : "0" 

View solution in original post

3 Replies
TRF
Champion II
Champion II

You should never use == to compare 2 strings.

Use 

"in stock".equalsIgnoreCase(row7.State) ? "1" : "0" 
daez
Creator
Creator
Author

Thanks a lot TRF, learning every day here.

 

Solved.

 

 

TRF
Champion II
Champion II

You're welcome