KB Article #176014

DML-mapper behaviour not coherent for X12 business document field real(len) with optional plus sign option checked?

Problem

-- for a X12 business document field real(len), pattern pmin, pmax, behaviour not coherent with optional plus sign option checked?
-- without optional plus sign, for integer values (no sign, no decimal character), an error will raise at facet check(if enabled):

[CNV - 9002]: Field too long (...), defined length is <p>
[CNV - 9030]: Cannot convert float field (...) (Business-Document Element ... of Business-Document ...) from external to internal format
[XOB - 101]: Conversion to internal format has failed:  Field too long (...), defined length is <p>. Field name is ...

-- with optional plus sign option, no error will raise length is 1 or 2 digits more than defined length

Resolution

* In the X12 standard, the length of a decimal type data element does not include the optional leading sign or decimal point. The X12 element length is not the physical length of the field, but the precision of the field; it is the total number of digits.
* it is normal behavior in the situations below:
- if the sign is replaced by digit -> the field is either variable with "Optional plus sign" checked or fixed and: "Plus sign position" != None or "Minus sign position" != None and +/- are not present in the input
- if the decimal point is replaced by digit -> the field is either variable with "Optional plus sign" checked or fixed and it has no scale length defined (like the case in our example)

Ex:

X12 business document field real(len)
pmin, pmax = 1,9 => defined length 9
optional plus sign option and facet check activated

1000000000 (10 digits) => value accepted
10000000000 (11 digits) => value accepted
+1000000000 (10 digits + sign) => value accepted

100000000000 (12 digits) => value rejected
+10000000000 (11 digits + sign => value rejected)