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.