Four 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.

 

 

 

 

 

 

 

 

11 REPLIES
Twelve 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
Four 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.

Twelve 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
Four 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.

Twelve Stars

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

@saivsr,can you post your job design?

Manohar B
Twelve 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
Four 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]

 

Twelve 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
Four Stars

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

Yes Manohar

Twelve 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
Twelve Stars

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

@saivsr,still do you have this issue?

Manohar B