Monday, March 7, 2016

X++ Consideration for Change Company Using

Refer to ChangeCompany and table buffers

Be careful when using 'changeCompany'. We have to clear the table buffer unless the company will not be changed as we expected. This happens when we use the same name of table buffer.

See below example.

    changeCompany('A')
    {
        while
        select  ModelGroupId
        from    inventModelGroup
        index   GroupIdx
        {
         ...
         ...
        }
    }
    changeCompany('B')
    {
        inventModelGroup = null;        //Need this statement to clear table buffer
        while
        select  ModelGroupId
        from    inventModelGroup
        index   GroupIdx
        {
         ...
         ...
        }
    }

No comments:

Post a Comment