Convert a string to long/integer while keeping the exact and correct decimal format

0
Hello,   Inside a loop, I have an input string like '$ 3.990,70', I iterate through a list and using the aggregate sum activity, I  want to do the sum of the string. To do so, I added a java action to filter out the numeric value from the string and to return a long but it returns 399070 instead of 3.990,70, what should I do to fix the problem knowing that the sum activity only accepts integer/long? Thanks.
asked
2 answers
1

You don't need  Java for that. If the format 3.990,70 is not dependent from language settings, you can use

 

parseDecimal('3.241,98', '#.###,##')

 

otherwise use replaceAll to change the decimal and thousand separators.

answered
0

From your Design I see you want to convert a decimal to integer 

So you can use Change Activity

Object (MyEntity) 

Set IntegerAttribute = $MyEntity/DecimalAttribute.toInt()

 

OR Javascript 

toInt($DecimalAttribute)

 

answered