Tuesday, October 30, 2012

Lookup





// create in Form/Fields/fields name/Methods
public void lookup(FormControl _formControl, str _filterStr)
{

    ;
    lookupMaster::lookupMasterNumber(_formControl);
}




//Create in class/ new method
public static boolean lookupMasterNumber(FormStringControl   _ctrl)

{
    SysTableLookup          sysTableLookup = SysTableLookup::newParameters(tablenum(Master1), _ctrl);
    Query                   query;
    QueryBuildDataSource    qdbsTransport;
    AvVendorRoleTable       avVendorRoleTable;
 
    ;
    //display
    sysTableLookup.addLookupfield(fieldnum(Master1, MasterNumber), true);
    sysTableLookup.addLookupfield(fieldnum(Master1, MasterID));

    //logic and assign table & field
    query           = new Query();
    qdbsTransport   = query.addDataSource(tablenum(Master1));
    qdbsTransport.addRange(fieldnum(Master1, AvStatus)).value(queryValue(Avstatus::Approve));
 

    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
    return true;
}

No comments: