Highlighted
Four Stars

How to convert negative values to () brackets

How to convert negative values to () brackets.

-7 to (7)

And i have columns with null values and i need that to insert as null and it should not throw any null error

 

 SRC

ColA  ColB

          2

-1       -7

TGT -- Output

ColA  ColB

          2

(1)     (7)

2 REPLIES
Twelve Stars

Re: How to convert negative values to () brackets

@ravi777,try this one

(!row3.newColumn1.equals("") || row3.newColumn1!=null) &&row3.newColumn1.contains("-")?"("+row3.newColumn1.replace("-","")+")": row3.newColumn1 

Manohar B
Twelve Stars

Re: How to convert negative values to () brackets

@ravi777,still do you have this issue?

Manohar B