Static, Dynamic and User-defined code table entries

I regularly use the API help file and the code examples it contains. After all why reinvent the wheel There is a good example of how to¬†retrieve values from a code table (search for “Code Tables Server” and select the entry with the same name). The example shows you how to create a code table server, load a combo box with certain entries or see if a certain value is in the table.

A while back I was looking to validate the gift pay method. I would retrieve the data from a CSV file and before applying it to the field in the gift I wanted to make sure it was a valid value. This way I could control the error message myself. This help file example was just what I needed.

The definition is:
variable = object.GetTableEntryID(sDescription, lTableNumber, [bUseShort])
The example in the help file was:

lLong = oCodeTablesServer.GetTableEntryID("Single", tbnumMaritalStatus, False)

If lLong did not have a value of 0 then it was a valid value. When you enter the code the intellsense will help you by giving you a list of table name constants which map to lTableNumber. I started to go down the long list of table names and was concerned to find that there was no pay method table.

After submitting a case I was told that this was in a static table. I later discovered that there are three types of table.

Dynamic (or regular as they are not actually referred to anywhere as dynamic)
Static
User defined

Dynamic and User defined tables use the same methods as shown in the example in the help file. The only difference is that there are no intellisense values for user defined tables and that you have to write some extra code to get the table number.

Static code tables have their own method for getting the table entry id:

Function StaticGetItemID(StaticTableNum As EStaticTableNumbers, sDescription As String) As Long

Now when I use intellisense with this method I get the static tables including pay method. I can now validate my pay method entries in the same way as the other table entries.

Why they didn’t make it a uniform method I don’t know.