Outer Join in D365 F&O - X++ Code

Rumman Ansari   Software Engineer   2023-08-21   870 Share
☰ Table of Contents

Table of Content:


Outer Join in D365 F&O - X++ Code

An outer join combines rows from two or more tables based on a common column and includes rows that do not have matching values. In D365 F&O, you can achieve this using the join keyword along with the outer keyword to specify an outer join.

Orders - Table

Outer Join in D365 F&O - X++ Code

Customers - Table

Outer Join in D365 F&O - X++ Code

Write Query for Outer Join


internal final 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)
   {
       Customers cust;
       Orders orders;
 
       while select * from orders outer join cust 
           where orders.CustomerID == cust.CustomerID
       {
           Info(strFmt("%1 %2, %3", cust.CustomerID, cust.CustomerName, orders.OrderID ));
       }
   }
 
} 
Outer Join in D365 F&O - X++ Code

Output

Outer Join in D365 F&O - X++ Code

Another Example of Outer Join

Customers - Table

Outer Join in D365 F&O - X++ Code

Orders - Table

Outer Join in D365 F&O - X++ Code

Write Query for outer join


internal final 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)
   {
       Customers cust;
       Orders orders;
 
       while select * from cust outer join orders
           where orders.CustomerID == cust.CustomerID
       {
           Info(strFmt("%1 %2, %3", cust.CustomerID, cust.CustomerName, orders.OrderID ));
       }
   }
 
}


Outer Join in D365 F&O - X++ Code

Output

Outer Join in D365 F&O - X++ Code