How to Determine if an Address is Preferred During Importing Process
T
Tiffany Small
started a topic
over 6 years ago
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.
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
T
Tiffany Small
said
over 6 years ago
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"
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:
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!
W
Wayne Pozzar
said
over 6 years ago
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.
Tiffany Small
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