How to add range in multiple table lookup in dynamics ax

Description:-

In this article we will see about how to add range in multiple table lookup. here i have used multi table lookup in QueryBuildDataSource so we can add range in customer lookup. here i have given Job how to add range in multi-table lookup.

Job:-

public void lookup()
{
    Query                   query = new Query();
    QueryBuildDataSource    qbds;
    QueryBuildDataSource    qbdsJoin;
    SysTableLookup          sysTableLookup = sysTableLookup::newParameters( tableNum(InventTable), this);
    QueryBuildRange qbr;
    ;

    qbds= query.addDataSource( tableNum(InventTable));
    qbdsJoin= qbds.addDataSource( tableNum(InventModelGroupItem));
    qbdsJoin.relations( false);
    qbdsJoin.fields().dynamic(NoYes::Yes);
    qbdsJoin.addLink( fieldNum(InventTable, ItemId), fieldNum(InventModelGroupItem, ItemId));
    qbdsJoin.joinMode(JoinMode::InnerJoin);
    qbr=qbdsJoin.addRange(fieldNum(InventModelGroupItem,ModelGroupId));
    qbr.value('FIFO');
    qbr=qbdsJoin.addRange(fieldNum(InventModelGroupItem,ModelGroupDataAreaId));
    qbr.value(curext());
    //qbd.addRange(fieldnum(InventTable,ItemType)).value(SysQuery::value(enum2str(ItemType::Item)));
    //qbr.value('FIFO');
    sysTableLookup.parmQuery(query);
    sysTableLookup.addLookupfield( fieldNum(InventTable, ItemId),true);
    sysTableLookup.addLookupfield( fieldNum(InventTable,NameAlias));
    sysTableLookup.addLookupfield( fieldNum(InventTable,ItemType));
    sysTableLookup.addLookupfield( fieldNum(InventTable,Product));
    //sysTableLookup.addLookupMethod( tableMethodStr(InventTable,itemGroupId));
    //sysTableLookup.addLookupMethod( tableMethodStr(InventTable,defaultProductName));
   // sysTableLookup.addLookupfield( fieldNum(CustTable, VendGroup), true);
    //sysTableLookup.addLookupfield( fieldNum(InventTable, ItemId));
    sysTableLookup.performFormLookup();
}

Related Posts

Previous
Next Post »

Thanks for comments.....