I was asked to run this job:
inventTrans inventTrans;
inventDim inventDim;
while select sum(qty) from inventTrans
where inventTrans.ItemId =="1706"
join inventDim
group by inventBatchId
where inventDim.InventDimId ==
inventTrans.InventDimId
{
info(strFmt("Batch %1, qty %2",
inventDim.inventBatchId, inventTrans.qty));
}
However it doesn't run, I'm not sure what's wrong with this job?
Also, I was asked for to run this job:
static void InventTransBuildQuery(Args _args) { Query query; QueryBuildDataSource queryBuildDataSource; QueryBuildRange queryBuildRange; QueryRun queryRun; Qty total; InventTrans inventTrans; inventDim inventDim; query = new Query(); queryBuildDataSource = query.addDataSource(tableNum(InventTrans)); queryBuildDataSource.addSelectionField(fieldNum(InventTrans ,Qty),SelectionField::Sum); queryBuildRange = queryBuildDataSource.addRange(fieldNum(InventTrans, ItemId)); queryBuildDataSource = queryBuildDataSource.addDataSource(tableNum(InventDim)); queryBuildDataSource.addGroupByField(fieldNum(InventDim, InventBatchId)); queryBuildDataSource.relations(true); queryRun = new QueryRun(query); if (queryRun.prompt()) { while (queryRun.next()) { inventTrans = queryRun.get(tableNum(InventTrans)); inventDim = queryRun.get(tableNum(inventDim)); info(strFmt("Batch %1, qty %2", inventDim.inventBatchId, inventTrans.qty)); } } }
At #8, it asked me to enter 1706 in the item number field in the prompt, but I don't see this option, I just see this:
Any help is appreciated thank you!