Crosscompany Keyword in select statement in D365 F&O - X++ Code
Select Project properties
NMFA Company is selected.
NMFA Company is selected. Now open table browser and see data.
Remove NMFA Company which is already selected. Now make it blank blank and save it.
Now open table browser and see data.
class JoinExampleClass { /// <summary> /// Class entry point. The system will call this method when a designated menu /// is selected or when execution starts and this class is set as the startup class. /// </summary> /// <param name = "_args">The specified arguments.</param> public static void main(Args _args) { EmployeeTable emp; while select emp { Info(strFmt("%1 %2", emp. EmpId, emp. EmpName)); } } }
If you will remove company name from the project you will get default result of company.
If you want to take result from some specific set of company use container and the keyword crosscompany.
class JoinExampleClass { /// <summary> /// Class entry point. The system will call this method when a designated menu /// is selected or when execution starts and this class is set as the startup class. /// </summary> /// <param name = "_args">The specified arguments.</param> public static void main(Args _args) { EmployeeTable emp; container con= ["INMF", "DAT"]; while select crosscompany: con emp { Info(strFmt("%1 %2", emp. EmpId, emp. EmpName)); } } }
Above code will return result from ["INMF", "DAT"] company only.
If you don't want specific company you just select crosscompany keyword, It will select data from all companies.
class JoinExampleClass { /// <summary> /// Class entry point. The system will call this method when a designated menu /// is selected or when execution starts and this class is set as the startup class. /// </summary> /// <param name = "_args">The specified arguments.</param> public static void main(Args _args) { EmployeeTable emp; // container con= ["INMF", "DAT"]; while select crosscompany emp { Info(strFmt("%1 %2", emp. EmpId, emp. EmpName)); } } }
Comments
Post a Comment