General X++ Development

How do I use `outer join` in X++?

Asked by Sunny Vasty· Aug 13, 2026· 1 answers

How do I use outer join in X++?

SSunny Vasty75 reputation · answered Aug 13, 2026

Use outer join when the primary record should still come back even if the related record does not exist.

X++
CustTable  custTable;
SalesTable salesTable;

while select custTable
    outer join salesTable
        where salesTable.CustAccount == custTable.AccountNum
{
    info(strFmt('%1 - %2', custTable.AccountNum, salesTable.SalesId));
}

If there is no matching sales order, the customer still comes back and the joined buffer contains default values.