Inner Join in Custom Lookup in Ax form


Description:-

In this article we will see how to use Inner join in Custom lookup. If we used multiple tables in custom lookup then we have to join it or we have to create relation between them then we can use join. Here is the Example for create join in custom lookup.

Code:-

public void lookup()
{
    Query                   query = newQuery();
    QueryBuildDataSource    qbds;
    QueryBuildDataSource    qbdsJoin;
    SysTableLookup          sysTableLookup = sysTableLookup::newParameters(tableNum(A_PurchaseOrder), this);
    ;
    qbds= query.addDataSource( tableNum(A_PurchaseOrder));
    qbdsJoin= qbds.addDataSource( tableNum(A_PurchaseOrder_Old));
    qbdsJoin.relations(false);
    qbdsJoin.fields().dynamic(NoYes::Yes);
    qbdsJoin.addLink(fieldNum(A_PurchaseOrder, Purchase_ID), fieldNum(A_PurchaseOrder_Old, Purchase_ID));
    qbdsJoin.joinMode(JoinMode::InnerJoin);

    sysTableLookup.parmQuery(query);
    sysTableLookup.addLookupfield(fieldNum(A_PurchaseOrder, Purchase_ID), true);
    // sysTableLookup.addLookupfield(fieldNum(CustTable, VendGroup), true);
    sysTableLookup.addLookupfield(fieldNum(A_PurchaseOrder, Vender_Code));
    sysTableLookup.performFormLookup();
}

Related Posts

Previous
Next Post »

Thanks for comments.....