toString to multiply with value

0
Hi guys, Can you help me on how to make this string multiply with 1000? The data in string object type, but I want to multiply the data with 1000. Anyone know how to make it? Thank you.
asked
3 answers
0

There are three layers to the answer that you will have to understand.

Firstly, you cannot do mathematical functions between a string and a decimal/ integer. So You will have to convert the string to a decimal format ( eg: parseDecimal('Your String value', '#,###.##').

Secondly, this will allow you to do a mathematical function as shown below: parseDecimal('Your String value', '#,###.##') * 1000.

Thirdly, you can convert them into a string format using toString(parseDecimal('Your String value', '#,###.##') * 1000) or formatdecimal()

answered
2

Hi,

You need to use ParseDecimal to convert the String to a Decimal. You can then multiply this value by 1000, and use formatDecimal to convert that back to a String.

https://docs.mendix.com/refguide/parse-and-format-decimal-function-calls

Something like this should work, but you may need to tweak it to match your exact requirements.

formatDecimal(parseDecimal($IteratorAll_Import_FPW/ActualCostDown) * 1000), ‘#,###.#’ )

Hope this helps

answered
0

Hello Ikhwan,

You cannot do mathematical operation with string. Convert the string to integer (parse it) and then do this operation.

answered