Friday, May 27, 2016

Oddity with decimal behavior on custom Modifier currency fields

By Steve Endow

This is another one of those incredibly obscure quirks that I seem to have a talent for finding.  It isn't a huge deal, but for a heavy GP user who does a lot of data entry, I can see it being very annoying.

So my customer wants to add several custom fields to the Item Maintenance Options window.  A few of those fields need to be numeric, with 2 decimal places, to store a measurement, such as 8.25 inches.  (I don't recall why they didn't choose to use Extender instead of custom fields.)


So I added the fields, got the code working to read and save the custom fields, and then tested the fields.  While testing, I noticed something odd.

If you enter data into a 2 decimal currency field in Dynamics GP, when you type the first number, it will appear in the "cents" location--the second number after the decimal.  As you type additional digits, the numbers will append on the right, and field will fill to the left.

But, after you type one or more digits, you have the option of typing a period, or decimal.  When you do that, the digit(s) already in the field will jump to the left of the decimal, and the cursor moves to the position just right of the cursor, allowing you to type the numbers after the decimal.  Basically the decimal is always displayed in a fixed position, and you end up typing around it.

It's an unusual behavior that I don't think I've seen in any other application.  It's a bit tedious at first, but once you get used to it, it seems to work, and theoretically can allow you to save a keystroke by not typing the period.

While testing the custom fields I had added, I noticed that one field was behaving "normally"--I could type a decimal, and the numbers would jump to the left of the decimal.  But in other fields, when I typed a decimal, nothing would happen.

Here is a demonstration of the behavior: (animated gif)


When I type 1 in the Cubic field and then press period, the 1 jumps to the left of the decimal.  But when I type 9 in the Length field, and then press period, nothing happens.

The fields are the same type and use the same format, so this behavior is puzzling.  After trying several different formats, thinking that might be the cause, I tried one last change.

The only difference between the Cubic field and the Length field is the Keyable Length property.  Cubic allows 6 characters, while Length allows 5.


So I tried changing the Length field to have a Keyable Length of 6, just like the Cubic field.  Once I did that, the decimal behavior started working, and it behaved just like the Cubic field.

I tried several different Formats and that didn't help, so I don't think that is the cause.

Anyway, one more obscure and strange tale to add to the tome of Dynamics GP.

Steve Endow is a Microsoft MVP for Dynamics GP and a Dynamics GP Certified IT Professional in Los Angeles.  He is the owner of Precipio Services, which provides Dynamics GP integrations, customizations, and automation solutions.

You can also find him on Google+ and Twitter









No comments: