public void executeQuery()
{
QueryBuildDataSource cpj;
QueryBuildDataSource bol;
query query;
query = CustPackingSlipJour_ds.query();
cpj = query.dataSourceTable(tableNum(CustPackingSlipJour));
bol = cpj.addDataSource(tableNum(WMSBillOfLadingOrder));
bol.joinMoIde(JoinMode::ExistsJoin);
bol.fetchMode(QueryFetchMode::One2One);
bol.relations(false);
bol.addLink(fieldNum(CustPackingSlipJour, SalesId), fieldNum(WMSBillOfLading, InventTransRefId));
super();
}
I tried the same in a job and it worked:
static void Job21(Args _args)
{
Query query;
QueryRun queryrun;
QueryBuildDataSource cpj;
QueryBuildDataSource bol;
QueryBuildRange qbr1;
CustPackingSlipJour custPackingslipJour;
WMSBillOfLadingOrder wmsBillOfLadingOrder;
;
query = new query();
cpj = query.addDataSource(tablenum(CustPackingSlipJour));
qbr1 = cpj.addRange(fieldnum(CustPackingSlipJour,orderAccount));
qbr1.value(queryvalue('CUST001'));
bol = cpj.addDataSource(tablenum(WMSBillOfLadingOrder));
bol.relations(false);
bol.joinMode(joinmode::InnerJoin);
bol.addLink(fieldnum(CustPackingSlipJour,SalesId),fieldnum(WMSBillOfLadingOrder,InventTransRefId));
queryrun = new queryrun(query);
while(queryrun.next())
{
custPackingslipJour = queryrun.get(tablenum(CustPackingSlipJour));
wmsBillOfLadingOrder = queryrun.get(tablenum(WMSBillOfLadingOrder));
info(strfmt("%1 - %2",custPackingslipJour.salesid, wmsBillOfLadingOrder.billOfLadingId));
}
}
Tidak ada komentar:
Posting Komentar