Need Help in Logic

Hi All,

My input is 123.45 β†’ i should transform as 12345
123.456 then i should transform as 12345 should include only two characters after decimal point.

thank you in advance!

Hi Manigandan,

Try with this expression: $num.toString().substring(0, $num.toString().indexOf(β€œ.”) + 3).replace(β€œ.”, β€œβ€)

Where $num is the field name of the number.

Thanks,
Pero M.

4 Likes

Hi @Manigandan,

Along Pero’s solution, this might also help:

Math.floor($num*100)

3 Likes

@Manigandan: I will personally go with @bojanvelevski’s approach as it is less overhead on the system and easy to troubleshoot for other developers when you’re not working on that pipeline anymore.

Thank you @bojanvelevski for sharing that.

2 Likes

Or you can also do a parseFloat($num.toString()).toFixed(2).replace(β€˜.’,β€˜β€™)

FYI, this will force .00 for whole numbers e.g. 123 will be 12300

:smiley:

1 Like