Cognito-forms – Mathematics and decimal places

cognito-formszapier

Decimal Places
I'm trying to send number data through Zapier, but Zapier does not seem to pick up the 2 decimal places when they are '.00'. In addition, it only picks up one number after the decimal place when the second number is 0.

Here's what I'm doing: form user enters two numbers. My form then:

  1. Adds these numbers together (SUBTOTAL)
  2. Multiplies SUBTOTAL by 0.23 (VAT)
  3. Adds SUBTOTAL to VAT (TOTAL)

On Cognito Forms, all of these numbers display to two decimal places (even when they are '.00'). However, when I send the information through Zapier, Cognito Forms appears to have dropped the 2 decimal places if they are '.00', or dropped one decimal place if it is, for example, '.20'.

I have read the support section on math functions and it looks like Math.Round(Number, Number) might be what I'm looking for, however based on the provided instructions I cannot get that to work.

Does anyone have any advice?

Best Answer

In this case, the issue is more with how Zapier handles the data sent from Cognito Forms than with Cognito Forms itself.

All data sent via integrations, such as Zapier or JSON webhooks, is sent as real data, so text is sent as text, dates as dates (in ISO 8601 format), yes/no values as true/false Booleans, and numbers as numbers. Our integration lets Zapier know what the type of each field is so it can handle the information accordingly.

If you want to force the information sent to Zapier to have a specific number of decimal places, then consider adding a Calculation - Text field and using a calculation to pull the value of your number and turn it into a text value with the number of decimal places that you want. You also may be able to update your Zap configuration to handle this, but that would likely depend on the app your are ultimately connecting to through Zapier and what types if information it supports.

Here is the calculation to convert a numeric field into a text value with two decimal places:

=MyNumberField.ToString("N2")