Hello,
i use this code for create QueryBuildDatasource, this code works on the SalesLine table :
static void Job47(Args _args)
{
QueryRun qr;
QueryBuildDatasource qbds;
;
qr = new QueryRun("SalesLine");
qbds = qr.query().dataSourceTable(tablenum(SalesLine));
info("toto");
}
if i change by an other table, for example SalesTable this code doesn't work and qbds is null.
i don't uderstand why ?
somebody can help me please. thank you in advance.
*This post is locked for comments
it works now, thank you very much John.
have a nice day
You can try this.
SysQuery qr = new Query(queryStr(SalesLine)); //replace SalesLine with the name of your AOT query
oups, i forgot to create a query for InventTransferTable :-)
if i change in your code 'SalesLine' by 'InventTransferTable' i have this error : The query InventTransferTable does not exist.
below the code :
static void Job47(Args _args)
{
Query query = new Query();
QueryRun qr;
InventTransferTable inventTransferTable;
;
query.addBaseQuery('InventTransferTable');
qr = new QueryRun(query);
while (qr.next())
{
inventTransferTable = qr.get(tableNum(InventTransferTable));
info(inventTransferTable.TransferId);
}
}
thank you for your answer John.
in fact, i would like to read all data in InventTransferTable with the input parameters (fromDate_Period1,toDate_Period1,...) and add range. But the qbds is alway null, i don't know why ?
if i change InventTransferTable by SalesLine the code below works :
qr = new QueryRun("InventTransferTable");
qbds = qr.query().dataSourceTable(tablenum(InventTransferTable));
qbdrInventTransferStatus = qbds.addRange(fieldnum(InventTransferTable,TransferStatus));
qbdrSalesStatus.value(queryValue(InventTransferStatus::Created));
qbdrShipDate = qbds.addRange(fieldnum(InventTransferTable,ShipDate));
if (fromDate_Period1 || toDate_Period1)
{
qbdrShipDate.value(SysQuery::Range(fromDate_Period1, toDate_Period1));
}
else
{
qbdrShipDate.value(SysQuery::valueUnlimited());
}
if(myGplELCCarrierName!="")
{
qbdrGPLELCCarrierName = qbds.addRange(fieldnum(InventTransferTable,GPLELCCarrierName));
qbdrGPLELCCarrierName.value(queryValue(myGplELCCarrierName));
}
while(qr.next())
{
myInventTransferTable = qr.get(TableNum(InventTransferTable));
}
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,134 Super User 2024 Season 2
Martin Dráb 229,928 Most Valuable Professional
nmaenpaa 101,156