Form Calculation: How to format calculation result as currency?

  • IDECORP
    Asked on September 14, 2018 at 8:18 AM

    Bom dia!

    Preciso que o resultado do cálculo seja expresso em formato de moeda, com pontos e vírgula, exemplo: 123.456,00.

    Atualmente, aparecem apenas números: 123456, conforme imagem em anexo.

    Qual seria a solução?

    Obrigado, 

    James

    Jotform Thread 1580641 Screenshot
  • Kevin Support Team Lead
    Replied on September 14, 2018 at 9:49 AM

    You may use the commaSeparate() function, more details about the different math functions can be found here: https://www.jotform.com/help/267-Form-Calculation-Math-Function-Reference 

    Here's where you will find the function:

    Form Calculation: How to format calculation result as currency?  Image 10

    You will need to perform the entire calculation in the function. 

    I hope this helps. 

  • IDECORP
    Replied on September 14, 2018 at 1:12 PM

    Olá!

    Verifiquei que o formato da nossa moeda no Brasil é diferente.

    Utilizamos pontos para separar  os milhares e vírgula para os centavos, asssim:

    123.456,00 e no sistema está diferente: 123,456.00.

    É possível inverter?

  • Welvin Support Team Lead
    Replied on September 14, 2018 at 1:39 PM

    Use our Masked Input widget to do it.

    https://widgets.jotform.com/widget/masked_input

    Guide: https://www.jotform.com/help/252-How-to-Add-a-Widget-to-your-Form.

    Add the widget and configure your separators as such:

    Form Calculation: How to format calculation result as currency?  Image 1 Screenshot 30

    Leave the other options default.

    Now, add a conditional logic to copy the calculation result to the Masked Input widget. Example:

    Form Calculation: How to format calculation result as currency?  Image 2 Screenshot 41

    Here's a demo: https://form.jotform.com/82565134401955.

    You can hide the calculation widget and name the masked input widget after its name, so that would be presented to your users instead of the actual calculation.

    Guide: https://www.jotform.com/help/434-How-to-Hide-Form-Fields.

  • IDECORP
    Replied on September 14, 2018 at 2:01 PM

    Ótimo! 

    Obrigado pelo suporte!

    Abraço!

  • IDECORP
    Replied on September 16, 2018 at 6:11 PM

    Boa noite!

    Eu compreendi a instrução, fiz como recomendado, criei a condição para copiar o valor do campo 10 para o campo 11, que foi criado com o widget indicado, mas o valor não aparece, veja o anexo.

    Favor verificarem o problema.


    1537135854PONTUACAO VALOR JOTFORM Screenshot 10 

  • Welvin Support Team Lead
    Replied on September 16, 2018 at 6:48 PM

    Let me investigate this and get back to you. 

  • IDECORP
    Replied on September 18, 2018 at 6:30 PM

    Olá!

    Conseguiram descobrir o problema?

  • Jed_C
    Replied on September 18, 2018 at 8:00 PM

    The problem was the masked input widget does not accept transferred value from other fields. Would using a short text entry field work for you?

    ex.

    1537315149short text mask input Screenshot 10

    If that works for you, you can pass the value to a short text entry field. Please refer to our guide here https://www.jotform.com/help/381-Getting-Started-with-the-Basics-of-Input-Masking.

    I hope that helps. Let us know if you have any questions or if you need further assistance. 

  • IDECORP
    Replied on September 19, 2018 at 8:36 AM

    Bom dia!!

    O resultado do cálculo que aparecerá no campo é variável, às vezes com 7 dígitos (12.345,67), às vezes 10 (12.345.678,90)... 

    Nesse caso, inserindo a máscara funcionará, independentemente do tamanho do resultado?

  • Richie JotForm Support
    Replied on September 19, 2018 at 10:04 AM

    Unfortunately,you must define the mask input if it is 10 digits or 7 digits only.

    Here is a sample screen cast in which I have set only the mask input to 7 digits.

    Form Calculation: How to format calculation result as currency?  Image 1 Screenshot 20



    Please give it a try and let us know if it fits your requirements.

    Thank you.

  • IDECORP
    Replied on September 19, 2018 at 2:16 PM

    Nesse caso, então, não existe algum outra solução no jotform para que o campo do resultado do widget form calculation seja demonstrado em formato de moeda?

    Há algum outro widget que ofereça esse recurso?

  • Richie JotForm Support
    Replied on September 19, 2018 at 2:37 PM

    Unfortunately, there are no other widgets that would masked your input to your preferred format.

    You can still use my colleagues work around regarding masking. However, you must set your amount to either 7 or 10 digits.

    Guide:https://www.jotform.com/help/381-Getting-Started-with-the-Basics-of-Input-Masking

    Hope this information helps.

    Thank you.