Monday, April 22, 2019

Difference between changeCompany and CrossCompany in X++?

CrossCompany:- By using this keyword we can retrieve data from multiple companies or from all companies.
         
                 Example:-
                    CustTable cust;
                    Container con;
                    con=["ceu","Dat","cee"];
                    Select crosscompany:con cust;
                    print cust.accountnum;
                    pause;


                 Example:-
                    CustTable cust;
                    Select crosscompany cust;
                    print cust.accountnum;
                    pause;


ChangeCompany:- By using this keyword we can change company any time and retrieve data from specific companies.

                Example:-
                    CustTable cust;
                    Select *from cust;
                    print cust.accountnum;
                    changecompany("Cee")
                    {
                     cust=null
                    Select *from cust;
                    print cust.accountnum;
                     }
                    changecompany("Ceeu")
                    {
                     cust=null
                    Select *from cust;
                    print cust.accountnum;
                     }
                    pause;

Reference :- https://community.dynamics.com/ax/b/poojakarkiblogforax/archive/2014/12/22/crosscompany-and-changecompany-in-ax

1 comment:

  1. Thanks for sharing this.,
    Leanpitch provides online training in Scrum Master during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days CSM Certification Workshop in different cities.


    CSM online certification

    ReplyDelete

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// &l...