One Star

data type converting problem in tAggregateRow

Hi all
In the source table in databse,the type of column 'USA_USDUnitPrice' is decimal. When output in talend, it was bigdecimal. But I want to insert one row which 'USA_USDUnitPrice' values 0,and we get a error,can't convert bigdecimal to int. So i transfer it as Object type.,it works fine.
However,in tAggregateRow,when i sum 'UnitPrice',I get the warning :
'Warning:the operation 'sum' for the output column 'USA_USDUnitPrice' can't be processed because of incompatible input and/or output types'.
I think that it couldn't be sumed with the data type object,how can i solve this issue by a easy method.
Thank you for any suggestion.

Best Regards
Joe
13 REPLIES
Community Manager

Re: data type converting problem in tAggregateRow

Hi Joe
Can you upload some screenshots of job?
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: data type converting problem in tAggregateRow

Hi Shong
Thank you for your reply.
We can't upload or download any source without the permission of IT. Maybe I can Email you some screenshot .
Is that ok?
Joe
Community Manager

Re: data type converting problem in tAggregateRow

Hi Joe
Yes, just do it. Export the job and send it to me.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: data type converting problem in tAggregateRow

Hi shong
I have sent the sample and some screenshot to you.
Thank you for your help.
Best Regards
Joe
One Star

Re: data type converting problem in tAggregateRow

Hi shong
any suggestion about the job that i send to you?

Thank you very much
Joe
Community Manager

Re: data type converting problem in tAggregateRow

Hi Joe
I did't receive any email from you, which email have you sent to? Please try again.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: data type converting problem in tAggregateRow

Hi shong

I send it again both to your two email. pls check your email again. Thank you very much.
Best Regards
Joe
Community Manager

Re: data type converting problem in tAggregateRow

Hi Joe
Yes, you are right. it couldn't be sumed with the data type object!
But I want to insert one row which 'USA_USDUnitPrice' values 0,

Sorry, I don't understand why you want to insert value 0 but doing 'sum' operation on this column?
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: data type converting problem in tAggregateRow

Hi Shong

There are three tmaps,'USA','CAN',and 'USB',and three related column,'USA_USDUnitPrice','CAN_UnitPrice','USB_UnitPrice'.
For example,in tMap 'USA',we get the value of 'USA_USDUnitPrice',and set the other two as 0.00;in tMap 'CAN',we get the value of 'CAN_USDUnitPrice' and
set 'USA'AND 'CAN' as 0.00.
At last ,we union these three all,and sum .
Best Regards,
Joe
Community Manager

Re: data type converting problem in tAggregateRow

Hi
Set a default value for bigDecimal type as below:
new java.math.BigDecimal(0)
union these three all and sum them on tAggregateRow, select 'bigDecimal' type on output table.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: data type converting problem in tAggregateRow

Hi Shong
it works. but i get a new problem. According to the requirement,I have to sum 'USA_USDUnitPrice' twice,and value to two defferent fileds,and here comes the error
'Duplicate field AggOperationStruct_tAggregateRow_1.SUA_USDUnitPrice_sum'
how can i solve this ?
Thank you very much
Best Regards,
Joe
Community Manager

Re: data type converting problem in tAggregateRow

Hi
Where do you sum 'USA_USDUnitPrice' twice? Can you upload a screenshot?
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: data type converting problem in tAggregateRow

Hi
in the tAggregateRow, I will sum the field 'USA_USDUnitPrice' twice.

output Function input
USA_USDUnitPrice sum USA_USDUnitPrice
CAN_USDUnitPrice sum CAN_USDUnitPrice
USA_USDUnitPrice sum USB_USDUnitPrice
like this. and i will get the error. I just don't want to use another tMap to value for USB_USDUnitPrice. Each processing in tmap,it will take a lot of time.
Best Regards,
Joe