One aspect of the API that is really well thought out is the whole Meta data structure. Back when RE7 was written, there was no reflection built into VB6. Java had it and there was some libraries that could do it but nothing was built in. Reflection (in coding terminology) is the ability to be aware of the classes and methods that are available to the code during run time.
From the outset Blackbaud introduced Meta data into each object of the API. Given that it is possible to customize fields in RE, make some mandatory, change the labels of others, having objects that can be interrogated to find out, say the “first name” is required or if the “last name” field is actually “surname” (or vice versa) makes the user experience much richer. It also means that you can write an application that will not break if, some time in the future, you decided to make, say a specific attribute required.
To look at an object’s meta data you use the IBBMetaField interface. Some object implement this interface, others have an the MetaField property.
Here is a simple example:
Private Sub testMeta(oConstit As CRecord)
Dim oMeta As IBBMetaField
Set oMeta = oConstit
If oMeta.Required(RECORDS_fld_FIRST_NAME) = True Then
MsgBox "First Name is a required field"
MsgBox "Last name has the label of " & oMeta.DisplayText(RECORDS_fld_LAST_NAME)
MsgBox "The social security number field can be found in the " & _
oMeta.DBTableName() & " table in the " & _
oMeta.DBFieldName(RECORDS_fld_SOCIAL_SECURITY_NO) & " column " & _
" even though it is called " & oMeta.DisplayText(RECORDS_fld_SOCIAL_SECURITY_NO)
MsgBox "The longest middle name a person can have is " & oMeta.MaxFieldLength (RECORDS_fld_MIDDLE_NAME) & _
The results appear as follows:
While this is a trivial example is shows what can be achieved if you want to perform the same action on all fields on an object for example.