Thursday, May 12, 2016

Enterprise Portal DATASET LOOKUP CODE X++

Enterprise Portal DATASET LOOKUP X++

Query to create a dataset lookup in AX Enterrprise portal .

void dataSetLookup(SysDataSetLookup sysDataSetLookup)
{
    List                    _list;
    Query                   query = new Query();
    QueryBuildDataSource    queryBuildDataSource1, queryBuildDataSource2, queryBuildDataSource3 ;
    QueryBuildRange         queryBuildRange,queryBuildRange2,queryBuildRange3;
    DirpartyTable           dirpartyTable;
    ;

    _list = new List(Types::String);
    _list.addEnd(fieldstr(EmplTable, EmplId));
    _list.addEnd(fieldstr(EmplTable, EmplName));


    queryBuildDataSource1 = query.addDataSource(tablenum(EmplTable));
    queryBuildDataSource2 = queryBuildDataSource1.addDataSource(tablenum(Dimensions));
    queryBuildDataSource2.joinMode(JoinMode::InnerJoin);
    queryBuildDataSource2.addLink(fieldnum(EmplTable,EmplId),fieldnum(Dimensions,Num));


    queryBuildRange       = queryBuildDataSource2.addRange (fieldnum (Dimensions, DimensionCode));
    queryBuildRange.value(queryvalue(sysdimension::Purpose));

    sysDataSetLookup.parmLookupFields(_list);
    sysDataSetLookup.parmQuery(query);
}

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...