Five Stars

Tmap if else rexpression for multiple collums

Hello, I have six collums col1, col2, col3, col4, col5, col6 and i need to map them.

 

Example from col4 i have to map to cod2 colum but if the col4 is null or empty i sould get the data from col5 if is not null, but if its col5 is null i have to get it form col3.

 

How and i do this in tmap with a expression.

1 ACCEPTED SOLUTION

Accepted Solutions
Seven Stars sgv
Seven Stars

Re: Tmap if else rexpression for multiple collums

Hi

 

(col4 != null && !coll4.isEmpty() ) ? col4 :

(col5 != null && !coll5.isEmpty() ) ? col5 : col3

 

Good luck,

SGV

2 REPLIES
Twelve Stars TRF
Twelve Stars

Re: Tmap if else rexpression for multiple collums

Here is the required expression:

 

row1.col4 != null && !"".equals(row1.col4) ? row1.col4 :
      row1.col5 != null ? row1.col5 : row1.col3

 

Hope this helps


TRF
Seven Stars sgv
Seven Stars

Re: Tmap if else rexpression for multiple collums

Hi

 

(col4 != null && !coll4.isEmpty() ) ? col4 :

(col5 != null && !coll5.isEmpty() ) ? col5 : col3

 

Good luck,

SGV