Hi,
I am trying to query all the sales lines for the past 12 months for a givne Item.
I have created a query the following query but it returns three time the error Query extended range failure: Expected identifier near pos 11.
And then all the lines in the table.
Can someone tell me waht I am doing wrong ?
Thanks.
Here is my query:
static void TestingQuery(Args _args)
{
Query query;
Queryrun queryRun;
QueryBuildDataSource salesLineDs;
SalesLine salesLine;
query = new Query();
salesLineDs = query.addDataSource(tableNum(SalesLine));
salesLineDs.name("Sales");
salesLineDS.addRange(fieldNum(SalesLine,ItemId)).value("ATQR1/2");
salesLineDs.addRange(fieldnum(SalesLine,ShippingDateRequested)).value(strFmt('((%1.2% > %3) && (%1.2% < %4))',
salesLineDs.name(),
fieldStr(SalesLine, ShippingDateRequested),
Date2StrXpp(today()-352),
Date2StrXpp(today())));
queryRun = new queryRun(query);
while (queryRun.next())
{
salesLine = queryRun.get(tableNum(SalesLine));
info(strFmt("Itemid = %1 qty = %2 date shipping = %3",
salesLine.ItemId, salesLine.QtyOrdered,SalesLine.ShippingDateRequested));
}
}