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;
}
{
SalesTable salesTable;
container con = [SalesStatus::Delivered, SalesType::Sales, SalesStatus::Invoiced];
select from salesTable
where salesTable.SalesStatus in con;
}
No comments:
Post a Comment