Start a new topic

Importing/matching records based on attribute value

I'm  trying to do something probably very similar to what Geraldo did in this thread

I'm a seasoned programmer, but very new to IOM and especially its API.  Looks very promissing though. 

Basically what I'm trying to do is almost exactly the same thing.  We get some gift data from an online source, but would like to match those gifts with existing constituents in RE.   This data doesn't have a constituent ID or Import ID, only the outside system id.
We store the "outside system" ID of these donors in an attribute for each donor.  PM-COIN ID

I'm attempting to do the same thing where I have a query in RE that pulls all these COIN IDs (outside ID) from the attributes, along with the constituent IDs and last names) and places them into array, which should then be used by IOM to do the matching.   

I modified the code he presented in his thread, but I feel like I might be missing something. 
I think I'm supposed to assign those array fields to virtual fields,  and that's where I need some major handholding.

here's what I have:


Public Overrides Sub BeforeImport(ByVal Cancel As ImportOM.API.iCancel)
  'Import has not been started yet
  Dim oQuery As New BBREAPI.CQueryObject
  Dim queryLength As Long

  oQuery.LoadByField(2,"COIN Import IDs")

  queryLength = oQuery.QuerySet.NumberOfRecords
  Dim queryArray(queryLength,2) As String
  RECOINIDs = queryArray

  Do While Not oQuery.QuerySet.EOF
  RECOINIDs(oQuery.QuerySet.RowNum, 0) = oQuery.QuerySet.fieldValue(1) 'Constituent Specific Attributes PM-COIN ID Description
  RECOINIDs(oQuery.QuerySet.RowNum, 1) = oQuery.QuerySet.fieldValue(2) 'Last Name
  RECOINIDs(oQuery.QuerySet.RowNum, 2) = oQuery.QuerySet.fieldValue(3) 'Constituent Import ID

 End Sub


Hi Paul,

I might suggest storing that ID in a constituent alias. That way IOM will be able to use that for the lookup natively (it's one of the options for looking up constituents).

If that's not possible, then you are on the right track with your code. You have the information that you need, now you just need to tell IOM to actually link the gift to the record!

I would suggest making a virtual field mapped to the constituent import ID (let's call it ConsID).

Then, in BeforeComputedColumns you will want to pull the ID from your array based on the gift field from the profile and set ConsID to the corresponding Constituent Import ID.

You assign values to virtual fields just like normal fields.

Now the profile row has the correct Constituent Import ID in a mapped field and IOM will do the work for you!

is there a class or something that would give me a better understanding of this whole API thing? I watched the little intro video and that got me started but I really need a deep understanding of it.
Login or Signup to post a comment