Start a new topic

How to Determine if an Address is Preferred During Importing Process

Good evening, 

I am new to Raiser's Edge and Importomatic. I would like to ensure that the preferred address for a constituent does not get overwritten during an import. For instance, we are importing addresses of type "Home" from Banner. If a constituent has a preferred address which is a "Business" address in RE, we would like this address to remain as preferred. 

I was able to achieve the above through use of a virtual field. However, if a constituent has a "Home" address that is preferred, then the new "Home" address that is imported should become preferred; currently, that is not the case for this test scenario, as the Preferred virtual field is set to No. I was looking to use the API to accomplish this with some additional coding, but I would need to be able to read the RE data first before determining the value for the preferred flag for the incoming address.  I am open to all solutions. 

Your assistance is greatly appreciated. 

Thank you. 


Best,

Tiffany


Hi Tiffany,

Yes, I would think you could use the IOM API when the existing constituent record is identified to determine whether or not you wanted to set the Preferred flag on the incoming address to true. If you wanted to take a stab at the code we'll be glad to help you along way.

Thanks,
Jeff
Thank you, Jeff.

I reviewed the API manual and have the following coding. I do, however, need some assistance with the syntax for the RE field:

If Export.Fields.GetByExcelName("J").Value = "Home" And CONSTIT_ADDRESS("Preferred").Value = "-1"
Then
Import.Fields.GetByExcelName("AT").Value = "yes"

Else Import.Fields.GetByExcelName("AT").Value = "no"

End If

That is the logic I think I would need to use.

I also reviewed a previous forum post, https://www.omaticsoftware.com/Forums/tabid/108/aft/1752/Default.aspx, and, based on the solution provided, it seems like I have to use the Code Editor instead. Is this correct? If so, can you please provide assistance with the coding?


Thanks,
Tiffany
Ah! I see. Sooo, this can definitely be done, but I'm afraid you're going to have to climb some of the RE7 API Object Model Learning Curve first. This is a rite of passage for anyone programming with RE! :) I think the best place to start would be the RE API doc, typically found here:

C:\Program Files (x86)\Blackbaud\The Raisers Edge 7\Help\API.pdf

Once you've dug into that some, you're probably going to need to cycle through the addresses on the constituent record to find the preferred one and do something if the Type is home (proto-code below):

Dim oRec As CRecord
Dim oAdd As CConstitAddress

For Each oAdd In oRec.Addresses
If oAdd.Fields(CONSTIT_ADDRESS_fld_PREFERRED) = -1 Then
If oAdd.Fields(CONSTIT_ADDRESS_fld_TYPE) = "Home" Then
'do stuff here
End If
End If
Next


Hope this is pointing you in the right direction!
Hello Tiffany,

Another resource that is useful for learning the RE API is C:\Program Files (x86)\Blackbaud\The Raisers Edge 7\Help\REObjects.chm

I think you are going to need to use the AfterConstituentOpen IOM function. Once you have that then you have have access to the matched record in IOM and you can then look at the oRec.PreferredAddress to get the current preferred address information.

At the end of this post there is some code that looks at the zip codes of the preferred address. That should give you a good start for what you want to do.
https://www.omaticsoftware.com/Forums/tabid/108/aft/1089/Default.aspx#2735

Login or Signup to post a comment