• Resolved gresgres

    (@gresgres)


    Wondering if there’s a way to show number in percentage form i.e. 60% instead of 0.60 and also is there a way to round up number to show only 2 decimal points i.e. 2.568 => 2.57?

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @gresgres

    If you want show the numbers in percentage format, emulate then with currency controls. For example, you can insert a currency field in the form, entering the % symbol as the “Currency” attribute, even you can configure the field to be formatted dynamically. But you should have present in the implementation of the equations that this field represents a percentage value.

    For example, assuming you want calculate the X percent of Y, and the field that represent the percentage is the fieldname1 and the second number the fieldname2, the equation in this case would be:

    
    fieldname2*fieldname1/100
    

    If you want get the result with two decimal places, use the PREC operation:

    PREC(X,Y) rounds the number X to Y decimal places.

    Applying it to the previous equation:

    
    PREC(fieldname2*fieldname1/100, 2)
    

    Note: I’m working in an update of the plugin that includes an checkbox in the settings of number fields to indicate the number field represents a percent, and would manage its value as percentage.

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘percentage & Number Roundup’ is closed to new replies.