Cognito-forms – Formatting a calculation field number

cognito-forms

I have two date fields with a calculation field to determine the total days between the two, using the code:

= (DepartureDate-ArrivalDate).TotalDays

The calculation field is a number type, but the result always shows a decimal result and I can't find a way to force it to be a whole number. I've tried the Int32.Parse method but it doesn't change anything. Giving the field a Text type works okay, but then I can't use the result in another calculation further down the form.

Any ideas please?

Best Answer

One option would be to add an additional calculation field to represent the numeric value that is set to Show This Field - Never. This field will only be available in calculations, so will not affect the layout of your form.