how to pass string and integer values in to string column..

Five Stars

how to pass string and integer values in to string column..

Hi All,

 

I have src XML file..

 

I am getting data for one column like..Int and String value,,i want to load the data in to table..the table column has string data type.

 

Source (str&int)           Target(str)

235451562                  235451562

63453635                    63453635

jsysysfags                   jsysysfags

 

the above way i need to pass.

 

but i a, facing issue..like

 

if i parser to int then int will be the problem.

 

if i change to .toString() then String value will be the problem.

 

source by default taking input is integer.

 

Please suggest me for good solution.

 

 

 

Thank you.

 

 

 

 

 

 

 

 

Forteen Stars

Re: how to pass string and integer values in to string column..

@saivsr,while readig from source if you read as sting data type you will not get any error. So read as a sting data type from XMl file for the source column.

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Five Stars

Re: how to pass string and integer values in to string column..

@manodwhb,

 

My source is XML, i read source as document,so it is reading this column as integer based on data.

Forteen Stars

Re: how to pass string and integer values in to string column..

@saivsr,in Source metadata/Schema,you can change integer to sting.

 

tFileInputXml

Basic settings >>Edit schema>>change the column type from integer to sting.

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Five Stars

Re: how to pass string and integer values in to string column..

reading source XML reading data type as Document..so i con't change my data type.

Forteen Stars

Re: how to pass string and integer values in to string column..

@saivsr,can you post your job design?

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Forteen Stars

Re: how to pass string and integer values in to string column..

@saivsr,if you are reading as Document,you can conevrt data type from Documnet to Sting in tXmlMap or tJavarow.

row1.col.toString()

 

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Five Stars

Re: how to pass string and integer values in to string column..

pfa

 

Monohar,,i have tried many functions for this.

 

.toString(),

String.ValueOf()

 

,TalendDate.parseDate("EEE MMM dd HH:mm:ss z yyyy"

TalendDate.formatDate("MM/dd/yyyy HH:mm:ss",TalendDate.parseDate("EEE MMM dd HH:mm:ss z yyyy",row1.CREATED_ON))

 

Mathematical.NUM([row12.doc:/asx:abap/asx:values/TAB/item/USNAM])=1?[row12.doc:/asx:abap/asx:values/TAB/item/USNAM]:Integer.parseInt([row12.doc:/asx:abap/asx:values/TAB/item/USNAM])


[row12.doc:/asx:abap/asx:values/TAB/item/USNAM].toString().trim()


Mathematical.NUM([row12.doc:/asx:abap/asx:values/TAB/item/USNAM]=1)?[row12.doc:/asx:abap/asx:values/TAB/item/USNAM]:
Mathematical.INT([row12.doc:/asx:abap/asx:values/TAB/item/USNAM])

 

[row2.doc:/asx:abap/asx:values/TAB/item/USNAM].equals(null)?"":Mathematical.NUM([row2.doc:/asx:abap/asx:values/TAB/item/USNAM])!=1?[row2.doc:/asx:abap/asx:values/TAB/item/USNAM]:[row2.doc:/asx:abap/asx:values/TAB/item/USNAM].toString().trim()


[row2.doc:/asx:abap/asx:values/TAB/item/USNAM].equals(null)?"":[row2.doc:/asx:abap/asx:values/TAB/item/USNAM].length>0?[row2.doc:/asx:abap/asx:values/TAB/item/USNAM]:[row2.doc:/asx:abap/asx:values/TAB/item/USNAM].toString().trim()


StringHandling.LEN([row2.doc:/asx:abap/asx:values/TAB/item/USNAM].toString())>0?[row2.doc:/asx:abap/asx:values/TAB/item/USNAM].toString().trim():[row2.doc:/asx:abap/asx:values/TAB/item/USNAM]


Mathematical.NUM([row12.doc:/asx:abap/asx:values/TAB/item/USNAM].toString().trim()==1)? [row12.doc:/asx:abap/asx:values/TAB/item/USNAM].toString().trim():null


Mathematical.NUM([row12.doc:/asx:abap/asx:values/TAB/item/USNAM]==1)? [row12.doc:/asx:abap/asx:values/TAB/item/USNAM].toString().trim():[row12.doc:/asx:abap/asx:values/TAB/item/USNAM]

 

Forteen Stars

Re: how to pass string and integer values in to string column..

@saivsr,do you import XML tree structe for tXmlmap fro input section?

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Five Stars

Re: how to pass string and integer values in to string column..

Yes Manohar

Forteen Stars

Re: how to pass string and integer values in to string column..

@saivsr,change the data type in the Xml tree,that the metadata from interger to sting for that column.

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Forteen Stars

Re: how to pass string and integer values in to string column..

@saivsr,still do you have this issue?

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch