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

Custom Lookup by joining InventSum and InventDim

$
0
0

Dear Friends,

I am trying to create custom lookup in ax 2009 by joining InventSum and InventDim Tables to show up InventBatchId in Cross Company. The code that I used is given below. It is not showing the lookup at all. When I executed the same query in job I am getting the expected results. Please suggest me where I have made mistake. Your help is much appreciated.

The same query works fine for a single table, but while joining tables something goes wrong.

public void lookup()
{
    
Query query = new Query();
QueryBuildDataSource qbds1,qbds2;
SysTableLookup sysTableLookup;
QueryBuildRange qbr1,qbr2,qbr3;
//super();
;

query.allowCrossCompany(true);
query.addCompanyRange(StringEditCompany.valueStr());

qbds1   = query.addDataSource(tableNum(InventSum));
qbr1    = qbds1.addRange(fieldNum(InventSum,Itemid));
qbr1.value("1234");

qbds2   = qbds1.addDataSource(tableNum(InventDim));
qbds2.relations(true);
qbds2.fields().dynamic(NoYes::Yes);
qbr2    = qbds2.addRange(fieldNum(InventDim,InventLocationId));
qbr2.value("WH1");
qbr3   = qbds2.addRange(fieldNum(InventDim,WMSLocationId));
qbr3.value("PICK");

sysTableLookup = SysTableLookup::newParameters(tablenum(InventDim), this);
sysTableLookup.parmQuery(query);
sysTableLookup.addLookupfield(fieldnum(InventDim, InventBatchid), true);
sysTableLookup.parmUseLookupValue(true);
sysTableLookup.performFormLookup();
}


Viewing all articles
Browse latest Browse all 175888

Trending Articles



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