Monday 7 May 2018

Hiding the lookup elements in Ax 2012

// Hiding the lookup elements if the element is assigned with another records other wise lookup will shows the all elements
public void lookup()
{
 
    Query                    query;
    QueryBuildDataSource     qbds,qbds1;
    QueryBuildRange          qbr;
    Sa_HideValue             sa_HideValue1;           // child table having form we are insering the lookup values into child table
    Sa_DuplicateHideValues   sa_DuplicateHideValues;  // this table having the lookup :parent table:
    SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(Sa_DuplicateHideValues), this);

    query                         = new Query();
    qbds                          = query.addDataSource(tableNum(Sa_DuplicateHideValues));
    qbds1                         =qbds.addDataSource(tableNum(Sa_HideValue));
    qbds1.joinMode(JoinMode::NoExistsJoin);
    qbds1.relations(true);
    //qbds1.addLink(fieldNum(Sa_DuplicateHideValues,ProjectNames),fieldnum(Sa_HideValue,ProjectNames));
    qbr                           = qbds.addRange(fieldNum(Sa_DuplicateHideValues,ProjectNames));
    sysTableLookup.parmQuery(query);
    sysTableLookup.addLookupfield(fieldNum(Sa_DuplicateHideValues, ProjectNames));
    sysTableLookup.performFormLookup();
}

No comments:

Post a Comment