How to round a number to the nearest hundredths?

  • Guilbault_Lucie
    Demandé le 19 juin 2024 à 08:42

    Bonjour,

    Sur ce formulaire, je souhaiterais dans la question / champ actuel : "Prix final estimé (arrondi à l'entier le plus proche)" remplacer le calcul actuel en suivant la règle suivante :

    Je souhaiterais en effet que le prix affiché soit cette fois-ci arrondi à l'entier décimal le plus proche soit : si le prix est à 1840 -> On arrondi à 1800. Est-ce possible ?

    Pour info, ce champ est basé sur la valeur précédente qui est déterminée dans le champ "Chiffre après prix du client -9%".

    Merci d'avance,

    Lucie

  • Princess Jotform Support
    Répondu le 19 juin 2024 à 10:37

    Hi Lucie,

    Our French Support agents are busy helping other Jotform users right now, so I'll try to help you in English using Google Translate, but you can reply in whichever language you feel comfortable using. Or, if you'd rather have support in French, let us know and we can have them do that. But, it might take a while until they're available again.

    Now, coming back to your question, unfortunately, there's no built-in function (fx) that we can use to round the field's value from 1840 to 1800. The following are functions’ arguments that you can use in rounding numbers/calculations in your form:

    If you want to learn more about functions you can use with the Form Calculation widget, you can check out this guide on Form Calculation - Math Function Reference.

    If that’s not exactly what you’re looking for, can you explain a bit more, so we can help you better? It would also help us to understand what’s happening if you could take a screenshot and send it to us. We have a guide here explaining how to do that.

    Give it a try and let us know if there’s anything else we can help you with.

  • Guilbault Lucie
    Répondu le 20 juin 2024 à 03:34

    Hi,


    Thanks for your answer, I was indeed looking to round a price from 1840 to 1800 but if you say it's impossible, then I won't implement it. Is this something that could be submitted to the dev team by any chance?


    Thanks


    Lucie

  • Raymond Jotform Support
    Répondu le 20 juin 2024 à 05:41

    Hi Lucie,

    To round a number from another field to the nearest hundredths, we can do that with the Form Calculation widget. Let me show you how to do that:

    1. In Form Builder, click on the Add Element button on the left and under the Widgets tab click on the Form Calculation widget.
    2. Next, use the Function, Add Field, and operators within the Form Calculation Settings to replicate the same formula below:
    3. How to round a number to the nearest hundredths? Image 1 Screenshot 30

    Here's how the form will work:

    How to round a number to the nearest hundredths? Image 2 Screenshot 41

    Feel free to test this demo form or clone it to your account to inspect it further. We also have a guide on How to Perform Calculations Using a Widget that you can check out.

    Give it a try and let us know if you need any help.

  • Lucie Guilbault
    Répondu le 20 juin 2024 à 12:40

    Hi,


    Thanks very much, it worked perfectly !


    Cheers,

    Lucie