Start a new topic

Skip row through API?

Is it possible to "skip" a row programatically through the API?  This would roll back any changes that have been made FOR THAT ROW but continue the import.

My example is for creating tribute records.  If I don't find a match for the acknowledgee on an In Memory gift then i want to roll back the whole tribute creation for that gift (because with nobody to acknowledge there is no reason to have a tribute).  This case comes about if I have a partial address for the acknowledgee.  I want IOM to try and find that record using the partial address data, but not create a record for them if they don't already exist.  And, in fact, roll back the whole tribute creation since now we don't have an acknowledgee.

Can I throw an exception or something to skip a row in the import?


Looks like iCancel is what I am looking for.

Does this roll back everything that has happened for this row including record creation and edits?
It does and pushes the row to the exception file. Additionally you have the option to specify a reason for cancelling which shows up in the error log.
The answer seems to be yes, it produces an exception and rolls back everything!

The Wayne One Man Show is here all week folks!
Hi Nic,

What do I need to NOT have in a row to make the Tribute creation skip a line?

I will be importing a list of gifts, only some of which have tribute information. Within that subset of tribute gifts, only some of them actually have full tribute information including a valid mailing address. Some tributes are just "in honor of children everywhere" or "in honor of Dave" which I do not want to create a tribute for (even though they have some tribute information).

I tried blanking the Tribute Type and First/Last name of the honoree but IOM still looked for the other tribute information. Is there some critical piece of tribute information that will make IOM skip the row (without an error)? Is there a way for me to programatically skip a row without creating an exception?
Hi Wayne,

Pretty much any tribute fields that have a value will prompt IOM to attempt to create a tribute. We spent a lot of time debating this issue on many different record types (gifts, events, membership, relationships, tributes, etc) and finally resolved that to be consistent for our users, if some data is available for a particular record type we were going to do our best to create (or update) that record. We did not feel it was up to IOM to decide whether or not the user intended to create a record based on partial data, and wanted to err on the side of IOM letting the user know that it tried it's best to create a record with the data supplied but could not. So... you will need to blank out all tribute fields if you do not want IOM to attempt to create a tribute record.

Jeff

Makes sense.

I think the easier solution for me is to just throw an exception for the row if Tribute Type is blank and make sure that the exception note is clear that it is an expected exception. That also lets my processors blank out just one cell in the import file if they want to exclude a particular tribute from the import.

Hey Wayne,

I think it actually would be easier to take care of it once in code rather than dealing with those exceptions forever. You can generically cycle through all the fields, check the record type, then blank out the field value if you don't want it, like this:

If Not bAddTribute Then
     For Each field as ImportOM.API.iField In Import.Fields
          If field.RecordType = ImportOM.API.eRecordTypes.RecordType_Tribute Then
                  field.Value = ""
          End if
     Next
End If


Let me know if that doesn't work for you...

Jeff

Thanks Jeff, this is helpful and I do something similar to this but it isn't what I need here.

If you only get rid of the tribute fields IOM still looks up/creates the honoree constituent record, even if there is no tribute correct? I also have acknowledgee information to deal with which is of type Individual Relationship, not Tribute.

I use this method though for removing the acknowledgee information if it already exists on the tribute. I actually do something like:
For Each Field, if Field.Group = 1 then make it blank
which deletes all of the acknowledgee relationship information.

I could just blank out the whole line I guess so it would just skip it? Maybe I will try that!
Hmmmm, haven't tested it, but I think a blank line might get you an exception. What might be better is to blank out everything, then change the Constit ID to your own constituent record (or if you happen to have a test record). It would process nothing for that row, so nothing would change and there would be no exception for the row.
Sounds crazy, I like it!
Getting back to Cancel.CancelRow

What, exactly, does it do? Does it exit the row right there? Does it finish processing and then cancel?

I think I am seeing that it continues running the code after the call, but then I also see that it exits at some point.
It will continue running your API code after the call. So if you want to prevent that use "Exit Sub" after you cancel a row.
Will it stop at the end of the Sub though? I am setting it in a function that is called within the AfterConstituentOpen sub.

From what you said I assume that it will continue through the end of my function, and then through the end of the AfterConstiuentOpen Sub, but then it will stop right?
Correct
Login or Signup to post a comment