Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

How to create the following while select into an x++ query

$
0
0

How to create the following while select  into an x++ query,

z_RentalOrderTable rent;
TransDate                td = today() - 7;

while select firstonly100 rent order by PostedDate desc

where (rent.PostedDate > td && rent.RentalOrderStatus == z_RentalOrderStatus::Posted)

  || rent.RentalOrderStatus == z_RentalOrderStatus::Approved

{

info("orders");

}

I want the (posted orders from the past week or approved order of any date) in the output.

I tried the following, 

this.query().dataSourceTable(tableNum(z_RentalOrderTable)).addrange(fieldNum(z_RentalOrderTable,Rentalorderstatus)).value(strfmt('(((%1 = %2) && (%3 > %4)) || (%5 = %6))',
fieldStr(z_RentalOrderTable,Rentalorderstatus),
any2int(z_RentalOrderStatus::Posted),
fieldStr(z_RentalOrderTable,PostedDate),
dateRange,
fieldStr(z_RentalOrderTable,Rentalorderstatus),
any2int(z_RentalOrderStatus::Approved)));

This didn't work. its showing approved orders and ( posted orders with no control on its date)

Please help.

Thanks ,

Praveen


Viewing all articles
Browse latest Browse all 175888

Trending Articles