RE-Decoded

A technical look at the Raiser’s Edge API from Blackbaud

Filling a .NET dropdown with code table entries

September 23rd, 2008 by David Zeidman

One of the good things about the CCodeTablesServer class is the ability to fill a combo with code table entries. For example if I have a custom form and want to be able to allow the user to select say, a title, I can simply call the CCodeTablesServer class method LoadCombo and my combo is filled up with titles. Well it is if I am using a COM environment such as VB6. But what do I do if I am using .NET?

This is not as straight forward but there is a useful method nevertheless. Instead of loading the combo directly we can use the CodeTableGetDataArray method that returns a two dimensional array consisting of the codetable id and the description.

        Dim array2d As Object
        Dim shortValues As Boolean = False
        Dim activeOnly As Boolean = True
        Dim codetable As ECodeTableNumbers = ECodeTableNumbers.tbnumTitles

        array2d = getCodeTableServer.CodeTableGetDataArray(codetable, shortValues, activeOnly)

        For i As Integer = 1 To array2d.GetUpperBound(1)
            titlesDropDown.Items.Add(array2d(1, i))
        Next i

The getCodeTableServer method simply returns an initialised code table server object for brevity. The CodeTableGetDataArray method would, in the VB6 world return a Variant. Since these are not supported in .NET an Object is return instead. This is a 2d array. The first dimension consists of two elements; the id and the description. The second dimension is as big as the code table has values. In the above example we make use of the description only.

I had known about this method for a while but how do we get the values in the static code tables? These values include things like gift types, pay methods, etc. What this space…

Related posts:

  1. Static, Dynamic and User-defined code table entries I regularly use the API help file and the code...
  2. Your own API Tools Class When I first started out working with Raisers Edge API...

Posted in Intermediate |

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.