Discussion

How to round off the value of decimal property to certain precision point?

This can be achieved through the custom java function.

Java Code:

  1. long factor = (long) Math.pow(10, PrecisionSize);
  2. Value = Value * factor;
  3. long tmp = Math.round(Value);
  4. return (double) tmp / factor;

Value and PrecisionSize are the parameters for this function.

Comments

Keep up to date on this post and subscribe to comments

Pega
November 1, 2018 - 8:28pm

Pega
March 23, 2019 - 12:20am

Hi,

Thank you for posting your question.

1. Open the "UserWorkForm" and add the below script.

<script>
$('#DecimalProp2').on('input', function () {
        this.value = this.value.match(/^\d+\.?\d{0,2}/);
    });
</script>

2. In the place of "DecimalProp2" you should add the element id of your property. You can find that using browser debugger tool as below.

Thank you,