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

Difference Between Edit And Display Method in Ax

Display Method: The display method means that the method’s return value is being displayed on a form or a report.  This value is fixed and c...