Start a new topic

Skip based on duplicate constituent ID

Is it possible to skip row (treat as exception) if constituent ID already exists in RE?  


Ideally we would like to do following, and I guess this would have to be done in code if doable. We would like to take an id 12345678 and check if there is a constitutent id 12345678A or 12345678S in the database and skip row.

1 Comment

Kerry, this seems like an interesting question - here is how I would approach it.


1. Create a virtual skip row field - I generally use a dictionary that skips if the value of the field is 1 hence I can simple populate a 1 into the field anytime I want to skip a record/import/etc

2. In the 'beforedictionaries' section of your import code use the following (Note: I have NOT tested and while it should be close it is simply off the cuff)

'------------------------------------------

'setup cRec as a constituent record data frame in the current session context

  Dim cRec As New blackbaud.PIA.RE7.BBREAPI.CRecord 

  cRec.Init(Import.SessionContext) 

'set cID to the constituent ID - basically change "D" to whatever your constituent ID column is

  cID=Import.Fields.GetByExcelName("D").Value

  'let's "TRY" to load the constituent record based on the constituent ID

  Try

 cRec.LoadByField(Blackbaud.PIA.RE7.BBREAPI.bbRECORDUniqueFields.uf_Record_CONSTITUENT_ID, cID)

'set field XX to 1 (my skip row field and value) to skip the record

 Import.Fields.GetByExcelName("XX").Value =1

'if the constituent record cannot be opened then it generates an error and skips setting the skip row field to 1 

Catch ex As Exception 

 Import.Fields.GetByExcelName("XX").Value =0

'end of the "TRY"

End Try

'keep things tidy by closing down the data frame

cRec.CloseDown

cRec=Nothing


The net is if the record can be opened based on the constituent ID then there is a duplicate constituent ID and the skip row is set otherwise the skip row is not set.


You can duplicate the code to append an "S" to the constituent ID to check that variation as well.


Thanks, Dennis dennis@ladnierfamily.com


Login or Signup to post a comment