Dynamics GP, Item description is one hundred character capacity?

A little curiosity of mine is around this finding & why it is so…

Dynamics GP Item description field


Fill the item description field of an item in dynamics GP and then paste the text into a notepad application to measure its length. You will find it has a capacity of one hundred characters…

measure capacity of UI as 100


Yet have a look at the database, it has a field size of 101…

Database field length is 101

 

but look, the UI is limiting the keyable length to 100…

Keyable length of Item Description 100

 

So there is an “extra” inaccessible character in the descriptions that you cannot use? What secret confidential information do you keep in your extra description extra character?

 

[Edit 2017/08/08] David in the comments explains this for us as:

Every string field of even length will have an extra character at the database level. 

This is a Dexterity feature from legacy behaviour. 

Before SQL was used as the database, Ctree and Btrieve was used. They performed better when each record in a table was a multiple of 16 bits, 2 bytes, as the early x86 processors were 16 bit. 

To ensure this string fields were padded to make the storage length an even number. Strings require the number of characters in the string plus a length byte when stored and so can be 0-255 characters long. 

On your screenshot, the keyable length is 100, plus a storage byte = 101, plus pad to even gives 102 with an extra hidden character. 

Odd length strings don't need padding to be an even total size. 

Comments (4) -

  • I've found nearly every field is like that in GP (char fields at least)!
    • Tim
      The random ones I looked at were all matching - must have got unlucky. I'm wondering if anyone will add some historical or technical context to why the characters get wasted.
  • Hi Tim

    Every string field of even length will have an extra character at the database level.

    This is a Dexterity feature from legacy behaviour.

    Before SQL was used as the database, Ctree and Btrieve was used. They performed better when each record in a table was a multiple of 16 bits, 2 bytes, as the early x86 processors were 16 bit.

    To ensure this string fields were padded to make the storage length an even number. Strings require the number of characters in the string plus a length byte when stored and so can be 0-255 characters long.

    On your screenshot, the keyable length is 100, plus a storage byte = 101, plus pad to even gives 102 with an extra hidden character.

    Odd length strings don't need padding to be an even total size.

    Hope this explains it.

    David

Add comment

Loading