Welcome to Forums Sign in | Join | Help | Forums
in Search


Membership Data from Gift

Last post 01-18-2010 1:46 PM by Matthew Norris. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-14-2010 9:42 AM

    Membership Data from Gift

    Hello,

    I'm pretty new to the RE API and I'm having difficulty doing something which seems like it should be simple on the surface, get the full CMembershipTransaction & CMembership object linked to a gift, including Gift of Membership.  I can get to the CGiftMembTrans object, but I cannot figure out how to get from this to the true CMembershipTransaction.  Any direction would be appreciated.

    Matt

    Filed under: ,
  • 01-18-2010 3:57 AM In reply to

    • David Zeidman
    • Top 25 Contributor
    • User Since: 2002
    • Posts 326
    • Organization: Zeidman Development
    • Products:  Blackbaud Direct Marketing, Blackbaud Enterprise CRM, The Information Edge, The Raiser's Edge

    Re: Membership Data from Gift

     I don't see any really simple way of getting directly to the object. The nearest that I can come up with is this:

     On the CGiftMemberTransaction object there is a field GIFTMEMTRANSACTION_fld_MemTransactionId. If you know that this is a current transaction and not a historical transaction you can load the membership object using the SQL where clause.The sql where clause points to the Membership view so you need to look at currentTransaction field of this view. See here for more information.

    If you want to look at possible historical transaction then this may be more problematic. Since you have the gift you can open up the constituent. I think that you then need to go through all the membership objects on the constituent record (CConstitMemberships collection) and then loop the Transactions collection until you find the transaction id (from above). There may be a simpler way than this but this is my first thought.

    David

    David Zeidman
    Zeidman Development
    http://www.zeidman.info

    Check out my RE API blog
    http://www.re-decoded.com
  • 01-18-2010 1:46 PM In reply to

    Re: Membership Data from Gift

     David,

    thanks for the reply.  I actually was able to come up with a nice way to do this using the CGiftDataHelper, I'm including the code below in case anyone else runs into this issue...

    Assuming  reCurrentGift is CGift we want Membership for...

        Dim dh As CGiftDataHelper
        Dim reGiftMemTran As CGiftMemTransaction
        
        Set reMembership = Nothing
        Set reMembTran = Nothing
        
        Set dh = New CGiftDataHelper
        dh.Init REApplication.SessionContext
        
        If reCurrentGift.MembershipTransactions.Count > 0 Then
            For Each reGiftMemTran In reCurrentGift.MembershipTransactions
                Set reMembership = New CMembership
                reMembership.Init REApplication.SessionContext
                reMembership.Load dh.Membership_GetMembershipIDForTransaction(reGiftMemTran.Fields(GIFTMEMTRANSACTION_fld_MemTransactionId))
                Set reMembTran = reMembership.Transactions.Item(reGiftMemTran.Fields(GIFTMEMTRANSACTION_fld_MemTransactionId))
                GoTo Located
            Next
        End If

Page 1 of 1 (3 items)