Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
SMahadevan1608028474
Contributor
Contributor

If then else condition while compare Interger and String datatype

Hi,

While reading the source file the below 2 column appear as below data type in output table as well schema editor in tmap.

row4.Department_id (Integer)

row4.Department_name (String)

My requirement is

if

Department_name

is empty I should bring the

Department_id 

value in

Department_name

column. So I have written the below logic,

row4.

Department_name

.isEmpty()?row4.

Department_id

:row4.

Department_name

It's causing the error cannot convert from Integer to String.

But the same logic works fine if the both column has String Datatype.I have some of the column were both are string.

Labels (2)
5 Replies
CLi1594691515
Contributor
Contributor

You need to parse row4.Department_id to String. String.valueOf(row4.Department_id)

SMahadevan1608028474
Contributor
Contributor
Author

Thanks for your email on this,

 

I have tried with the below way in output table for the dept_id column and change the datatype as String,

 

String.valueOf(row4.Dept_id)

 **************

The same way I have tried with Var in tMap,

 

(string)String.valueOf(row4.Dept_id) - String datatype and point this into one new column in output table name it as (Dept_id)

 

But both case am facing the same issue. Is anything wrong am doing here ?

SMahadevan1608028474
Contributor
Contributor
Author

Can some one help me on this if this my logic is correct ?

CLi1594691515
Contributor
Contributor

Your logic seems okay.

Can you screen cap your actual setting?

Actual coding

Var: String.valueOf(row3.dept_id)

Output: row3.dept_name.isEmpty() ? Var.dept_id_String : row3.dept_name

SMahadevan1608028474
Contributor
Contributor
Author

It's working fine and got the result. Thanks for help.