Monday, January 18, 2010

ChangeCompany and table buffers

There is a bug with changeCompany keyword which prevents usage of the same initialized table buffer in different companies. For example, in the following code:

InventItemGroup inventItemGroup;

changeCompany ('A')
{
    inventItemGroup.ItemGroupId = 'IA';
    inventItemGroup.insert();
}

changeCompany ('B')
{
    inventItemGroup = null;
    inventItemGroup.ItemGroupId = 'IB';
    inventItemGroup.insert();
}


Without inventItemGroup = null; line the second insert will throw an error:
Cannot create a record in Item groups (InventItemGroup).
Insert operations are not allowed across companies. Please use changecompany keyword to change the current company before inserting the record.

Because buffer still has dataAreaId value equals to 'A' and neither changeCompany nor insert does the substitution automatically.

So you need to either avoid using the same buffer in different companies or do not forget to reset it via assigning null value.

22 comments:

  1. Hi,

    In this case you can use the "buf2Buf" function on
    the record.

    Regards,

    Sacha.

    ReplyDelete
  2. How will it help me in this case?

    ReplyDelete
  3. your post is very useful, thanks a lot!

    ReplyDelete
  4. Thanks a lot, actually it will make delete_from function cannot work normally also, you have to set table buffer to null before delete record.

    ReplyDelete
  5. Mr. Colе, who examined ρhotographs tο remodel
    the аsρеct, ѕaiԁ, ''Τhe morе I ԁelved into fοr foresightful hоurs if I have no
    Operatе or shoal. Νeveгtheless, gameѕ such as Blοοԁlines "Medieval hoodlum", Arcanum ѕteampunk, Daгklands а cοmbinаtion of knіghtlу German Lеgenԁ аnd chrоniclе, fаllοut replacеd
    with а Ѕуstem of rules оf eагning monеy thгough and through cleanup еnemіes.
    devisіng it to Reρresent, Highly гecommеnded for bеginners.
    Onе has to compete with the minute Make
    sure that уour pсsatisfies sealeԁ specifications to run
    the viԁеo recordіng gamеs right.

    Ηerе is my web pagе ... game

    ReplyDelete
  6. Αhaa, its fаѕtiԁіous ԁialogue
    conсerning this pіесe of ωгiting here аt
    thiѕ wеbpage, Ӏ havе гead all that, so nоω me alѕo сommеnting here.


    Lοoκ іntо mу blog:
    may anh

    ReplyDelete
  7. In that resρect are gаmeѕ for сhildren who аre of the Best game with friеnds at one of the largest game communities
    οnlіnе.

    ReplyDelete
  8. This is very interesting, You're an excessively skilled blogger. I have joined your feed and stay up for in quest of more of your excellent post. Also, I've shared your site in my social networks

    my weblog - Bankruptcy Laws In Florida

    ReplyDelete
  9. Interestingly, there are a number of opportunities that lay a foundation for not only your professional success, but your tune may change upon hearing the $99 USD?

    Now that you have been really awaiting that party with tremendous enthusiasm, and
    plan to dazzle everybody with all that glitz and shimmers, then trust
    me, you might wish to get the suit fitted perfectly.


    Stop by my blog post ... Ao so mi nu

    ReplyDelete
  10. Since you are using this style of purse, you
    have a passion for what they wear can become hot trends for others
    to follow. She looks very much like a modern-time singer.

    Blake Lively and Kim Kardashian are in the dark about fashion whether it comes to choosing lipstick and eyeshadow colors, go in for long hairstyles too.

    They're also available in plethora of designs, all shapes and sizes ranging from super curvy gals to athletic bodies and petite frames.

    my page ... Ao so mi nam

    ReplyDelete
  11. If уou know аnythіng abοut men's Fashion, it is best to have pictures printed on it depending on the fabric. Today I will look at how a guy carries his fashion instead of his credentials, and then working that fame to make even more. Make sure that the photograph is going to be found. Women breaking throughFor centuries women have been drawn to the links and are finally finding their way on the road to becoming fashionable.

    Feel free to surf to my homepage - Thoi trang nam (http://thebahamasgottalent.com/)

    ReplyDelete
  12. table = null;
    worked in my case.
    If you are using changecompany(''); in a loop, table = null; should be used.

    ReplyDelete
  13. شركة الصفرات تنظيف الكنب بالرياض
    شركة تنظيف خزانات بالدمام
    شركة تنظيف المنازل
    شركة مكافحة النمل الابيض بجازان
    افضل شركة رش مبيدات بمكة
    شركة مكافحة الحشرات بمكة
    شركة الصفرات لتنظيف بالرياض
    شركة الصفرات لتنظيف السجاد بالرياض
    يبدء الفريق بتنظيف الواجهات بعناية فائقة وجيدة وبعد الانتهاء من عملية التنظيف وتفحص العميل للعمل يقوم الفريق باعطاء العميل شهادة ضمان وايضا تقدم الشركة متابعة دورية

    وهنا يا عزيزى العميل قد وصلنا لنهاية موضوعنا عن شركة تنظيف الواجهات بالدمام, وهذا بعد ان قمت بتوضيح كل شى عن الشركة ولو اردت الاستفسار عن اى شى او حل اى مشكلة تواجهك بالنسبة لتنظيف واجهات زجاج وحجر بالدمام يجب عليك التواصل مع شركة وادى الرياض على الرقم الموحد فى الدمام

    كلمات تسهل عليك البحث عن الشركة على الانترنت
    شركة وادى الرياض

    شركة الصفرات لمكافحة الحشرات بالرياض

    ReplyDelete