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

Problems building a query with the Query-Object-Framework in AX

$
0
0

Hi everyone,

i built a query in SQL Management Studio and now i'm trying to realize this query in a form.

This is the query:

select * from VENDPACKINGSLIPTRANS
   join INVENTTRANSORIGIN on 
       (INVENTTRANSORIGIN.INVENTTRANSID = VENDPACKINGSLIPTRANS.INVENTTRANSID)
   join INVENTTRANS on 
       (INVENTTRANS.INVENTTRANSORIGIN = INVENTTRANSORIGIN.RECID 
        and INVENTTRANS.PACKINGSLIPID = VENDPACKINGSLIPTRANS.PACKINGSLIPID
   where VENDPACKINGSLIPTRANS.QTY > 0
	and INVENTTRANS.STATUSRECEIPT = 2 
	and INVENTTRANS.STATUSISSUE = 0 
	and INVENTTRANS.INVOICEID = ''


I have problems to implement the marked link in AX.

This is the (unfinished) AX-Query:

qbds = this.queryBuildDataSource();
qbds.addRange(fieldNum(VendPackingSlipTrans, Qty)).value(SysQuery::valueNot(0));

qbds = qbds.addDataSource(tableNum(InventTransOrigin));
qbds.addLink(fieldNum(VendPackingSlipTrans, InventTransId), 
             fieldNum(InventTransOrigin, InventTransId));
qbds.joinMode(JoinMode::ExistsJoin);

qbds = qbds.addDataSource(tableNum(InventTrans));
qbds.relations(false);
qbds.clearDynalinks();
qbds.addRange(fieldNum(InventTrans, StatusReceipt))
              .value(queryValue(StatusReceipt::Received));
qbds.addRange(fieldNum(InventTrans, StatusIssue))
              .value(queryValue(StatusIssue::None));
qbds.addRange(fieldNum(InventTrans, InvoiceId)).value(queryValue(''));
qbds.addLink(fieldNum(InventTransOrigin, RecId), 
             fieldNum(InventTrans, InventTransOrigin));
//qbds.addLink(fieldNum(VendPackingSlipTrans, PackingSlipId), 
//             fieldNum(InventTrans, PackingSlipId));
qbds.joinMode(JoinMode::ExistsJoin);

The query works except for the marked fragment.  I wonder how to implement this link.

Any ideas?

Regards

Nils


Viewing all articles
Browse latest Browse all 175888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>