Decimal field settings (decimal places, cleanup)

Created by Jeremy Burgess, Modified on Wed, 30 Jan, 2019 at 6:00 PM by Jeremy Burgess

3 things to check:

  1. Auto-correct script - used to tidy the input but also used to check if the decimal element is 3 digits (4 characters including '.') when it will add in a 4th digit '0' to avoid international format ambiguity.
  2. Data type
  3. Normalisation

Auto-correct

using System.Text.RegularExpressions;

// Replace invalid characters
Value.Text = Regex.Replace(Value.Text, @"[^\-()0-9\.,]", "");

Regex regexFractionalMatch = new Regex(@"(?<Integer>(?:,?\d{1,3})+)(?<Fractional>\.\d{2,3})$");

Match m = regexFractionalMatch.Match(Value.Text);

if (m.Success)
{
    // Remove grouping from the integer bit
    Value.Text = m.Groups["Integer"].Value.Replace(",", "") + m.Groups["Fractional"].Value;
     
    // If the integer bit is 3 characters then make it 4 so ABBYY doesn't mistake for grouping
    if (m.Groups["Fractional"].Value.Length == 4)
    {
        Value.Text += "0"; // suffix a 0
    }
}

Data type

  • Money data type
  • Do not tick 'Must have fractional part'
  • Do tick 'Allow more than two digits in fractional part'
  • Do not tick 'Allow space as decimal mark'
  • Do tick 'Allow brackets for negative values'
  • Consider ticking 'Resolve separator ambiguity according to field regional settings' if international client

Normalisation

  • Remove digit grouping
  • Decminal mark = '.'
  • Min decimals 2
  • Max decimals 4

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article