Project

General

Profile

Bug #7484

decimal format - left-side 'balance' must include group separators

Added by Constantin Asofiei 10 months ago. Updated 10 months ago.

Status:
Test
Priority:
Normal
Target version:
-
Start date:
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD
case_num:

History

#2 Updated by Constantin Asofiei 10 months ago

This format is valid in OE: ->,>>>,>>9.9<<<<<<<<.

We have logic in NumberType.parseFormat which computes a leftBalance, but this is not incremented for the group separator. Including the group separator solves the issue.

The recreate is this:


def var h as handle.
create temp-table h.
h:add-new-field("f1", "decimal", ?, "->,>>>,>>9.9<<<<<<<<").

The fix is as simple as this:

      for(; i < len; i++)
      {
         switch (fmt.charAt(i))
         {
         case '>':
            leftBalance++;
            digits++;
            leftDigitFmt += fmt.charAt(i);
            break;

         case FORMAT_GROUP_SEP:
            leftBalance++;            // <!--------------- include the group separator
            leftSeps++; 
            break;

         default:
            break endLeftSection;
         }
      }

#3 Updated by Greg Shah 10 months ago

Is the problem that an error 22 is raised in FWD but not in OE?

What happens in the case where there is a mixture of > and other digit types (9, z, Z, *)?

#4 Updated by Constantin Asofiei 10 months ago

Greg Shah wrote:

Is the problem that an error 22 is raised in FWD but not in OE?

Correct.

What happens in the case where there is a mixture of > and other digit types (9, z, Z, *)?

Only the > and , (group sep) from left-side are balanced with the right-side <. The other 9, z, Z, * are not included in this balance.

#5 Updated by Greg Shah 10 months ago

What happens in the case where there is a mixture of > and other digit types (9, z, Z, *)?

Only the > and , (group sep) from left-side are balanced with the right-side <. The other 9, z, Z, * are not included in this balance.

In the 4GL? I know that is how the FWD code is written. I'm just wondering if the 4GL considers all the group seps in the case where some left side digits are not >.

#6 Updated by Constantin Asofiei 10 months ago

Greg Shah wrote:

What happens in the case where there is a mixture of > and other digit types (9, z, Z, *)?

Only the > and , (group sep) from left-side are balanced with the right-side <. The other 9, z, Z, * are not included in this balance.

In the 4GL?

Correct, I've tested now in 4GL.

I'm just wondering if the 4GL considers all the group seps in the case where some left side digits are not >.

As far as I can tell only the group sep characters and > are considered from left-side. But I've tested the group-sep on the right-side - this can be used, and is also included in the 'balance' for the right-side.

#7 Updated by Greg Shah 10 months ago

OK, go ahead with the change.

#8 Updated by Constantin Asofiei 10 months ago

  • Status changed from New to Review
  • Assignee set to Constantin Asofiei
  • % Done changed from 0 to 100

Created task branch 7484a from trunk rev 14648. The fix is in rev 14649.

#9 Updated by Greg Shah 10 months ago

Code Review Task Branch 7484a Revision 14649

No objections.

#10 Updated by Greg Shah 10 months ago

Go ahead with merge.

#11 Updated by Constantin Asofiei 10 months ago

7484a was merged to trunk rev 14650 and archived.

#12 Updated by Greg Shah 10 months ago

  • Status changed from Review to Test

Also available in: Atom PDF