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)

toos
2012-01-24 13:59:54

("notavailable".equals(row1.col1) || "not related".equals(row1.col1) || "na".equals(row1.col1))?new BigDecimal(0):new BigDecimal(row1.col1)

-----------------------------------
See java Doc for BigDecimal :

public BigDecimal(String val)
    Translates the string representation of a BigDecimal into a BigDecimal. The string representation consists of ...

buzzy
2012-01-24 12:56:18

tht should not be work,


getting the following issue with above code (janhess code)



any help,other than that....?

janhess
2012-01-24 11:29:34

BigDecimal(string)

buzzy
2012-01-24 11:21:21

thanking u for ur quick response smile ,but....

we can load if  target as INT or FLOAT (by using above syntax)

......BUT......

actually my target columns datatype's are big decimal!


HOW WE CAN CONVERT THAT INPUT STRING COL1 TO BIGDECIMAL?


thx

toos
2012-01-24 10:36:01

In tMap for column1:
("notavailable".equals(row1.col1) || "not related".equals(row1.col1) || "na".equals(row1.col1))?0:Integer.parseInt(row1.col1)

and for column2
"notavailable".equals(row1.col1)?1 : ("not related".equals(row1.col1)?2 : ("na".equals(row1.col1)?3:0)))

Hope it'll help

buzzy
2012-01-24 07:11:30

hi pals,

from excel file i am getting data like tis..

col1(source column)
----
notavailable
not related
na
10
notavailable
30
na

i need to load into target

col1(target column1) , col1-indicator (target column2)
------------------------  ------------------------
0                                1
0                                2
0                                3
10                              0
0                                1
30                              0   
0                                3


the logic is before loading into target :-

if col1='notavailable'    then  col1(target column1) as 0   and col1-indicator (target column2) as 1
if col1='not related'      then  col1(target column1) as 0  and col1-indicator (target column2) as 2
if col1='na'                  then  col1(target column1) as 0  and col1-indicator (target column2) as 3   
if col1=10                   then  col1(target column1) as 10 and col1-indicator (target column2) as 0


the problem is:

there is not consistance in source data!!!

can possible to do the above logic with tMap?,if let me know any one ,how it's?

NOTE: Both target columns are decimal


thx

Board footer

Powered by FluxBB