Post a reply

Write your message and submit

Options

Click in the dark area of the image to send your post.

Go back

Topic review (newest first)

talendtester
2011-04-06 21:03:14

Thanks mailforvijaym & shong,

I found out that my data had several bad records with less than the correct number of delimiters.

mailforvijaym
2011-04-05 07:12:36

Hi

do it like this

(row1.value1==null || row1.value1=="" )?null:Integer.parseInt(row1.value1)

or you can use


(row1.value1.length >0 )?null:Integer.parseInt(row1.value1)

Regards
Vijay.M

talendtester
2011-04-04 19:51:11

I get this error:

Exception in component tMap_1
java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at talenddemosjava.myJob_0_1.myJob.tFileInputDelimited_1Process(myJob.java:1171)
    at talenddemosjava.myJob_0_1.myJob.runJobInTOS(myJob.java:1682)
    at talenddemosjava.myJob_0_1.myJob.main(myJob.java:1556)

shong
2011-04-02 05:08:16

Hi

Is this close?
(row1.value1==null)?null:Integer.parseInt(row1.value1)

Yes, you are right. let us know if you don't get the expected result.

Best regards
Shong

talendtester
2011-04-02 04:47:42

This will convert a string to an integer:
Integer.parseInt(row1.value1)

How can I change this to work for converting a String to Int and return null there is no value?
(row1.value1==null)?null:TalendDate.parseDate("dd/MM/yyyy", row1.value1)

Is this close?
(row1.value1==null)?null:Integer.parseInt(row1.value1)

Board footer

Powered by FluxBB