Highlighted
Seven Stars

How can i Convert a row containing the float value (6.60) into the -6.60

I have a "*.csv" file with comma separated, containing a row of data type 'FLOAT' with value '(6.60)' , i have to convert this row into '-6.60'

How can i convert this?

Accepted Solutions
Highlighted
Six Stars

Re: How can i Convert a row containing the float value (6.60) into the -6.60

Hi

You Can use Mathematical.NEG function it will  Returns the arithmetic additive inverse of the value of the argument.

Highlighted
Moderator

Re: How can i Convert a row containing the float value (6.60) into the -6.60

@meetmahajan,convert float to sting and add "-" before the float to sting expression.

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

All Replies
Highlighted
Six Stars

Re: How can i Convert a row containing the float value (6.60) into the -6.60

Hi

You Can use Mathematical.NEG function it will  Returns the arithmetic additive inverse of the value of the argument.

Highlighted
Moderator

Re: How can i Convert a row containing the float value (6.60) into the -6.60

@meetmahajan,convert float to sting and add "-" before the float to sting expression.

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

Re: How can i Convert a row containing the float value (6.60) into the -6.60

Thanks both the solutions working perfectly.

Conversion Syntax :  Mathematical.NEG(Double.parseDouble(Variable.replaceAll("\\(", "").replaceAll("\\)","").trim()))

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog