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





Make the world a better place.

API: add table entries automatically.

Last post 11-12-2008 7:32 PM by Paul Black. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 03-26-2008 8:29 PM

    API: add table entries automatically.

    When doing an RE7 import you can opt (in code, using an object property, for example) to have table entries created automatically. Is there any way to do this when adding records using the API? Currently the only way I can see how to overcome this is when an error is returned (entry doesn't exist in code table) the record has to be added manually. 

  • 03-27-2008 9:09 AM In reply to

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

    Re: API: add table entries automatically.

    There is no automatic add to code tables value in the API. You have to first check to see if the value is in the code table and then if it is not you have to add it. If you are interested I can dig out some code for you.

     David

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

    Check out my RE API blog
    http://www.re-decoded.com
  • 11-10-2008 8:17 PM In reply to

    • Paul Black
    • Not Ranked
    • Posts 10
    • Organization: RMIT University
    • Products:  Blackbaud NetCommunity, The Raiser's Edge

    Re: API: add table entries automatically.

    Hi David, Im having similar problem. My problem is adding values to attributes where attribute itself has code table datatype. I got part to that of that code where im able to get the code table entry value for that attribute using

    Attribute Type Server which is given in api

     But im unable to find whether the value exist in attribute or not. Because GetTableEntryID is asking for ECodeTableNumbers where i cannot find this attribute code table.

     Can you help me with this issue.

    Code is given below.

    BBREAPI7.REServices rs = new BBREAPI7.REServices();

    rs.Init(ref _context);

    CCodeTablesServer oCodeTableServer;

    CAttributeTypeServer oAttributeTypeServer;

    int llong = 0;

    oCodeTableServer = (rs.CreateServiceObject(BBREAPI7.bbServiceObjects.bbsoCodeTablesServer)) as CCodeTablesServer;

    oAttributeTypeServer = (rs.CreateServiceObject(BBREAPI7.bbServiceObjects.bbsoAttributeTypeServer)) as CAttributeTypeServer;

    oCodeTableServer.Init(ref _context);

    oAttributeTypeServer.Init(ref _context);

    try

    {

    int lcodetableid = oAttributeTypeServer.GetAttributeCodeTableID(oAttributeTypeServer.GetAttributeTypeID("Academic Program Description", bbAttributeRecordTypes.bbAttributeRecordType_EDUCATION));

    //here lcodetableid value is 1028 but i cannot find in ECodeTableNumbers class

    int lAttlong = oCodeTableServer.GetTableEntryID("(R) MASTER OF BUSINESS ACCOUNTING", ECodeTableNumbers.  --- cannot find this value . if can find this then i can use addentry method to add the entry to this attribute

  • 11-11-2008 6:00 AM In reply to

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

    Re: API: add table entries automatically.

    The ECodeTableNumbers enum is just the numbers of standard (not user defined) code tables. You will not find your code table in this enum. However if you want to add an entry to a code table you need to use the following code (you will need to translate the VB.NET to C# but it is pretty straight forward -  you will just need to handle the "optional" parameters)

       Public Sub addToCodeTable(ByVal shortValue As String, ByVal longValue As String, ByVal codeTable As Integer)

            Dim tableLookupHandler As CTableLookupHandler


            tableLookupHandler = _REServices.CreateServiceObject(bbServiceObjects.bbsoTableLookupServer)
            tableLookupHandler.Init(_SessionContext, _CodeTableServer)

            oTableLookupHandler.AddEntry(True, codeTable, shortValue, longValue)


            tableLookupHandler.CloseDown()
            tableLookupHandler = Nothing


        End Sub

     

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

    Check out my RE API blog
    http://www.re-decoded.com
  • 11-11-2008 7:46 PM In reply to

    • Paul Black
    • Not Ranked
    • Posts 10
    • Organization: RMIT University
    • Products:  Blackbaud NetCommunity, The Raiser's Edge

    Re: API: add table entries automatically.

    Hi David,

    Thanks for your reply. I implemented your code in C# which is given below , but when im trying to use AddEntry method its unable to add that entry to database . Its always showing "Unable to add entry" . Could you please help me with this. What kind of users can use AddEntry method successfully. I mean what special permissions that user should have to add the entries. Or do i need to make any changes to get this working.

    object tblLookupForm = string.Empty; string sShortDes = "see this working";

    int codeTable= 32;

    if (!oCodeTableLookupHandler.AddEntry(true, codeTable, ref sShortDes, ref sShortDes, ref tblLookupForm))

    {

    outputerror =
    "Unable to add entry";

    }

    else

    {

    outputerror = outputerror +
    "<br/>Successfully added";

    }

  • 11-12-2008 3:19 AM In reply to

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

    Re: API: add table entries automatically.

     The only rights you need are those in admin, security and ensure that you have rights to the code table you are adding to. If you are a supervisor then this should not be a problem.

     One thought is that your short description is too long. It has a maximum of 6 characters. In most cases you do not need a short description. It is just a few code tables that actually make use of this (constituent codes, states, countries, etc)

     David

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

    Check out my RE API blog
    http://www.re-decoded.com
  • 11-12-2008 7:32 PM In reply to

    • Paul Black
    • Not Ranked
    • Posts 10
    • Organization: RMIT University
    • Products:  Blackbaud NetCommunity, The Raiser's Edge

    Re: API: add table entries automatically.

    Thanks David. I implemented as you specified and it really worked . It is very much appreciated and in short span of time you replied which is great. I got one more question related to this.  Is that possible to check the code table entry before adding . As you said we cannot use GetTableEntryID for codetables which are not in ECodeTableNumbers.

    Is there any other way to implement this functionality of check code table entry first  exists or not  and then add if doesnt exist . 

    Looking forward for your kind reply

     

     

     

Page 1 of 1 (7 items)