Change decimal point after convert using to string

Hi guys, Anyone know how to change the decimal point if we change the data to string? toString($MasterData/CSPHmin)+'-'+toString($MasterData/CSPHMax) Based on the image above, I want to make the number in 2 decimal places, but when I used  function, it show 8 decimal places.  
2 answers

You can use the Round Function to reduce the decimal precision before parsing your data to a string.

So, to use your example:

toString(  round($MasterData/CSPHmin), 2) +'-'+toString(   round($MasterData/CSPHMax), 2)

(You'll have to decide if you want to round before or after adding as they may lead to different values)


There is the formatDecimal function that you can use to do this.

formatDecimal($MasterData/CSPHmin, '0.0#') + '-' + formatDecimal($MasterData/CSPHMax, '0.0#')

The format of the decimal point will be related to your locale. You can override this by passing in an optional locale string, or use the Decimal Tools module in the marketplace to manually set it.

Hope this helps.