AX / D365FO – Not Exists join in X++

Below is the example for how to use notexists join in x++.

    public static void main(Args _args)
    {
        DlvMode    dlvMode;
        SalesTable  SalesTable;
        int i;
        

        ttsbegin;
        while select forupdate dlvMode 
          notexists join SalesTable where dlvMode.Code ==   SalesTable.DlvMode
        {
            dlvMode.delete();
            i++;
        }
        Info(strFmt("Total deleted records - %1", i));

        ttscommit;
    }

Leave a comment