Friday, April 15, 2016

AX FORM TABLE LOOKUP X++ CODE TABLE LOOKUP FORM LOOKUP

AX FORM TABLE LOOKUP X++ CODE TABLE LOOKUP FORM LOOKUP 


public void lookup()
{
 //   SysTableLookup sysTableLookup; // systemclass to create //customlookup
    Query query;
    QueryBuildDataSource qbd;
    SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(VIKASTable), this);
    ;
   // sysTableLookup = SysTableLookup::newParameters(tablenum(VIKASconfLocationTable));//_formcontrol);

    // Construct query on the table,
    // whose records you want to show as lookup.
    query = new Query();
    qbd = query.addDataSource(tablenum(VIKASTable));


    // add the fields to the lookup list
    sysTableLookup.addLookupfield(fieldnum(VIKASconfLocationTable,LocationID));
    sysTableLookup.addLookupfield(fieldnum(VIKASconfLocationTable,LocationName));

    // pass the query as parameter
    // system will show the records in the lookup
    // as per your query
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}


Form main datasource ka lookup
public void lookup(FormControl _formControl, str _filterStr)
{


   SysTableLookup sysTableLookup; // systemclass to create //customlookup
    Query query;
    QueryBuildDataSource qbd;
   // SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(VIKASTable), this);
    ;
    sysTableLookup = SysTableLookup::newParameters(tablenum(VIKASTable),_formcontrol);

    // Construct query on the table,
    // whose records you want to show as lookup.
    query = new Query();
    qbd = query.addDataSource(tablenum(Table)); 
    // add the fields to the lookup list
    sysTableLookup.addLookupfield(fieldnum(VIKASTable,Location));
   // sysTableLookup.addLookupfield(fieldnum(VIKASTable,LocationName));

    // pass the query as parameter
    // system will show the records in the lookup
    // as per your query
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

add table lookup in form
public void lookup(FormControl _formControl, str _filterStr)
{
    SysTableLookup              sysTableLookup;
    Query                              query;
    QueryBuildDataSource    queryBuildDataSource;
    QueryBuildRange             queryBuildRange;
    ;
    sysTableLookup  = SysTableLookup::newParameters(tablenum(EmplTable), _formControl);
    sysTableLookup.addLookupfield(fieldnum(EmplTable, EmplId));
    sysTableLookup.addLookupfield(fieldnum(EmplTable, legacyEmplId));
    sysTableLookup.addLookupMethod(identifierstr(name));
    query                              =  new Query();
    queryBuildDataSource    =  query.addDataSource(tablenum(EmplTable));
 
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...