Start a new topic

Match proposal by import ID / system ID?

Hi all,

Curious to know if anyone has used (used successfully / tried to use) the API to match proposal records by an ID?

Vanilla ImportOmatic only allows matching by name (or name + purpose). We have a data feed with a max char limit of 20, but our average proposal name length of 32. Maintaining a dictionary with every proposal in it is a possibility, but a distinctly unappealing one to be honest.

Anyway, I imagine this is probably possible, but wondered if anyone had already tried.

Cheers,

Tom


Hi Tom, nice pic!

Unfortunately it looks like the Proposal class does not have a .Load() method so you have to iterate through all of the proposals to find what you want!

I would suggest, if you are really going to do this, to load all of the proposals into a Key->Value array or VB Dictionary using the ID as the key and the Name/Purpose as the value in BeforeImport. Then, in a custom function, reference that data structure to look up the Name/Purpose by ID. Essentially you would be creating a dynamic dictionary before the import.

I forget how familiar you are with VB but if you need more clarification I could do a little pseudo-code to get you started.

Hi Wayne, could say the same to you!

Thanks for your reply. The lack of a load method sucks though. Your solution sounds like the best workaround. Let me have a play and I'll see what I come up with. May need to compare notes at some point, if you don't mind?

Cheers,
Tom
So actually, thinking about it more, you would generally look up proposals based on a constituent record. So, if you know the constituent that the proposal is linked to the list of proposals to look through is significantly shorter and might be ok to iterate through the list for each row.

Otherwise, another way to approach this is to set up a query in RE that returns all of the proposals you care about (i.e. open) with their ID/name/purpose. Then call that query from IOM in BeforeImport and load it into an array to search as I suggested originally. Someone else posted on here about how to do something similar to this with solicitors I believe.

This is the thread about loading a query into IOM

http://www.omaticsoftware.com/Forums/tabid/108/aft/1248/Default.aspx#3148
Thanks for the update. I think this approach might be stymied by the inability to expose either import id or system id in a query?
Grr
OK Wayne, I feel like I'm bashing my head against a wall with this one. I've tried loads of approaches (including starting with the constituent rather than the proposal), but I'm basically stumbling in the dark. The mix of my inexperience with (what feels like) some inconsistencies in the API make it a really frustrating experience.

If you wouldn't mind sharing some code, I'd be very grateful!
Actually, this seems to be doing the job:

[code] Public Overrides Sub AfterConstituentOpen(ByVal oRec As Blackbaud.PIA.RE7.BBREAPI.CRecord, ByVal Cancel As ImportOM.API.iCancel) MyBase.AfterConstituentOpen(oRec, Cancel) Dim sysId As String = Import.Fields.GetByExcelName("B").Value 'msgbox("In record of: " & oRec.Fields(BBREAPI.ERECORDSFields.RECORDS_fld_FULL_NAME)) Dim oProspect As BBREAPI.CProspect = oRec.Prospect Dim matchedPropName As String = "" If(oProspect.Proposals.Count() > 0) For Each oProposal As BBREAPI.CProposal In oProspect.Proposals Dim propName As String = oProposal.Fields(BBREAPI.EPROPOSALFields.PROPOSAL_fld_PROPOSAL_NAME) Dim propId As String = oProposal.Fields(BBREAPI.EPROPOSALFields.PROPOSAL_fld_ID) If (propId = sysId) matchedPropName = propName Exit For End If 'msgbox("Proposal: '" & propName & "' - #" & propId) Next If(matchedPropName <> "") 'msgbox("Proposal ID #" & sysId & " has name: '" & matchedPropName & "'") Import.Fields.GetByExcelName("D").Value = matchedPropName Else Cancel.CancelImport("Constituent has proposals, but none with a system ID of " & sysId) End If Else Dim cnid = oRec.Fields(BBREAPI.ERECORDSFields.RECORDS_fld_CONSTITUENT_ID) Cancel.CancelImport("Specified constituent (ID #" & cnid & " has no proposals") End if End Sub[/code]

May have glaring holes (my brain is fried), but they can wait 'til tomorrow morning!
looks great!
Login or Signup to post a comment