Five Stars

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?

 

 

 

Tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions
Thirteen Stars TRF
Thirteen Stars

Re: Tmap conditions working in test but not when executing

You should never use == to compare 2 strings.

Use 

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

TRF
3 REPLIES
Thirteen Stars TRF
Thirteen Stars

Re: Tmap conditions working in test but not when executing

You should never use == to compare 2 strings.

Use 

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

TRF
Five Stars

Re: Tmap conditions working in test but not when executing

Thanks a lot TRF, learning every day here.

 

Solved.

 

 

Thirteen Stars TRF
Thirteen Stars

Re: Tmap conditions working in test but not when executing

You're welcome

TRF