Thursday, 2 September 2021

SQL In Operator in X++ / D365FO

Sometimes we need to select the records only if the field value is in a set of expected values. Microsoft Introduce In Operator in X++ in D365FO. Remember this can only be used for enum type fields

First, you need to assign containers with specified values. Here is sample code where the query selects only the records with status delivered, Sales, Invoice in where clause

Static void main(Args args)
{
SalesTable  salesTable;
container con = [SalesStatus::Delivered, SalesType::Sales,  SalesStatus::Invoiced];
 
select from salesTable
where salesTable.SalesStatus in con;
}

No comments:

Post a Comment

Run AX report using X++

       Args                     args;      ReportRun          report;     salesLineProductPartProd salesLineProductPartProdLocal;     ;     ...