CLM02, SerializeToX12 and leading zeroes

Aug 3, 2012 at 10:45 PM

Upon calling SerializeToX12 on an Interchange containing a TypedLoopCLM, it serializes CLM02 with a leading zero when the CLM02 value is under 1.

For example, when CLM02 is equal to .01, the expected serialized string value is ".01".  However, the actual output is "0.01".

Will it be possible to change line 43 of TypedLoopCLM.cs to something like the following?
this._loop.SetElement(2, value.ToString().TrimStart('0'));


Aug 4, 2012 at 4:08 PM

This has been updated with changeset 18807.  Thank you for the catch.

Apr 4, 2013 at 2:45 PM
Along the same lines, should trailing zeroes be suppressed also. For example "300.00" should become "300" and "300.10" should become "300.1".

I've made a code change to deal with this issue. Should I make a pull request or send you the updated code? It's pretty trivial, so I guess you could do the same. Is this a change you would incorporate?
Apr 4, 2013 at 4:54 PM
I just double-checked the standard. And you are correct, trailing zeros are expected to suppressed unless you need to include them for precision, but that probably doesn't apply to CLM02 since it represents money. You are welcome to post your code change here, and I will get it updated to the source code.