Public Sub Export(oRow As IBBExportRow) 'List the columns in the output of the Export Const NAME = 1 Const ID_FIELD = 2 Const VB_FIELD = 3 If oRow.BOF Then 'This code will be processed once (at the beginning of the file). 'Here you would connect to an external database or run setup code MsgBox "Begin processing" ElseIf oRow.EOF Then 'This code will be processed once (at the end of the file). 'Here you would disconnect/close external databases if needed or run 'end of processing code MsgBox "End processing" Else 'This code will be processed once per row Dim oCon As CRecord Set oCon = New CRecord oCon.Init RE7.SessionContext Dim oInd As CIndividual Dim lID As Long 'get the id lID = oRow.Field(ID_FIELD) oCon.Load lID 'Determine if the record is an individual If oCon.Fields(RECORDS_fld_KEY_INDICATOR) = bbki_INDIVIDUAL Then For Each oInd In oCon.Relations.Individuals 'Loop through individual relationships to find spouse If oInd.Fields(INDIVIDUAL_fld_IS_SPOUSE) = True Then 'Compare spouse last name with constituent last name If oInd.Fields(INDIVIDUAL_fld_LAST_NAME) <> oCon.Fields(RECORDS_fld_LAST_NAME) Then oRow.Field(VB_FIELD) = "Different last name" Exit For End If End If Next oInd End If oCon.CloseDown Set oCon = Nothing End If End Sub
Note: In this example the following fields must be selected in the order listed in Export: Name, System Record ID, VBA User Field. The code must be in the System_Macros project to be selected in Tools, Export Options, VBA Macro.
Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Our Customer Support can help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality. If you are interested in learning more about the VBA and API modules, contact your account manager.