• Resolved akademiatortu

    (@akademiatortu)


    Hi-
    I have a calculated field which displays a number. I want to limit the amount of decimal places to 2.
    How can this be done?
    Thanks..
    Magda

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @akademiatortu,

    I recommend you to use currency fields instead numbers fields, and configure them to format their values dynamically.

    Best regards.

    Thread Starter akademiatortu

    (@akademiatortu)

    Thank you. But how can I enter a calculation into a currency field?

    Plugin Author codepeople

    (@codepeople)

    Hello @akademiatortu,

    My apologies, I’ve misunderstood your original ticket.

    You simply should use the “PREC” operation in the equation.

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

    So, If your current equation is for example: fieldname1+fieldname2

    The equation simply should be edited as follows: PREC(fieldname1+fieldname2, 2)

    Best regards.

    Thread Starter akademiatortu

    (@akademiatortu)

    Thank you!

    Thread Starter akademiatortu

    (@akademiatortu)

    Perfect, that worked ??
    Last question: how can I get a print button on the form?

    Plugin Author codepeople

    (@codepeople)

    Hello @akademiatortu,

    Please, install another of our plugins, the “CP Blocks” (https://www.ads-software.com/plugins/cp-blocks/). This plugin includes complementary blocks of code you can use with the forms created with the “Calculated Fields Form” plugin, and the “Contact Form 7” plugin, or directly in the content of the pages and posts.

    One of blocks is the “Print Form”, after insert the block in the form you simply should enter the following piece of code as the onclick event of a button in the form: printForm(‘[id*=”cp_calculatedfieldsf_pform”]’);

    and that’s all.
    Best regards.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Decimal Places in Calculated Field’ is closed to new replies.