Collections in The Raiser’s Edge API

The Raiser’s Edge API is somewhat of an antiquated beast. It is very powerful in as much that it allows you to do almost anything that you can do in the application itself. However it is old and uses an old technology (COM). One area where this is shown clearly is its use of collections. Almost all modern languages and frameworks (.NET, Java, php, etc) are zero indexed. This means that if you have an array the first element is accessed at the zero position.

The Raiser’s Edge API has collections such as the constituent address collection and the address phone collection. Each of these start at one rather than zero. This is OK. It is just a matter of getting used to it. What is more for most collections it is sufficient to use the “foreach” or “for each” construction (depending on your language of choice). Of course The Raiser’s Edge 7 being over ten years old (or thereabouts) has a few inconsitencies (I may have ranted about them in the past). It took me a while to discover why my code was failing with the message “Invalid Fund ID code”. I was sure the fund was valid. Of course it may have helped if it had told me which fund was invalid. It turns out that gift splits are stored in a zero based collection. What is more (and this I did know) there is always an initial split no matter how the gift is set up. So if you are working with gifts and there is the slightest possibility that you are going to work with split gifts then add the fund, campaign and appeal to the split collection direct rather than to the gift.

2 thoughts on “Collections in The Raiser’s Edge API

  1. “So if you are working with gifts and there is the slightest possibility that you are going to work with split gifts then add the fund, campaign and appeal to the split collection direct rather than to the gift.”

    I’ve found I have to create a new gift with the F/C/A information, then add splits with the F/C/A info for each split. The gift created then has the initial split with the first F/C/A info, and the additional splits with the F/C/A as appropriate.
    I tried not adding the F/C/A info to the gift, while trying to add splits with it, but received errors about those fields missing (when calling the save method).

  2. Kraeg,

    I think that you are right. When you create a new gift one split is automatically added for you. You need to edit that split first and then add any others. If there are no splits in the collection then you need to add one of the regular fund, campaign or appeal fields first (or the amount will also do the trick, I think – although this is untested) which will automatically add a split

Comments are closed.