Skip to main content
Question

Convert number to decimal

  • November 29, 2021
  • 0 replies
  • 75 views

Looking to have a field on a form that can accept an entered fraction 1/8,  a percent entered as 25%, Decimal .05 or an integer and have it display as a decimal in any case. Do I create a separate formula field?

------------------------------
Del
------------------------------
This topic has been closed for replies.

Here's the happy case where you don't have multiple slashes, a % at the beginning of the text or a combination of slashes and percent signs:

var number loc = Find([Number Text], "/");

If(Right([Number Text],1) = "%",ToNumber([Number Text]) / 100,
$loc > 0, (ToNumber(Left([Number Text], $loc - 1))) / (ToNumber(Right([Number Text], "/"))),
ToNumber([Number Text]))

------------------------------
Paul Peterson
------------------------------