Decimal field settings (decimal places, cleanup)
3 things to check:
- 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.
- Data type
- Normalisation
Auto-correct
using System.Text.RegularExpressions;
// Replace invalid characters Value.Text = Regex.Replace(Value.Text, @"[^-()0-9.,]", "");
Regex regexFractionalMatch = new Regex(@"(?(?:,?\d{1,3})+)(?.\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