May 08, 2012

Lookup in Table

Lookup in Table

Some times we need to create a lookuo on Tables itself, so to make a lookup in table methods add the following code in your object methods;

public static void lookupStaffTable(FormControl _callingControl, CITStaffPlanId _staffplan)
{
    Query query;
    QueryBuildDataSource qbds;
    SysTableLookup lookup;
    ;

    query = new Query();
    qbds = query.addDataSource(tablenum(CITStaffPlanLinesTable));
    qbds.addRange(fieldnum(CITStaffPlanLinesTable,StaffPLanId)).value(_staffplan);
    lookup = SysTableLookup::newParameters(tablenum(CITStaffPlanLinesTable),_callingControl,false);
    lookup.parmQuery(query);
    lookup.addLookupField(fieldnum(CITStaffPlanLinesTable, Position));
    lookup.addLookupField(fieldnum(CITStaffPlanLinesTable, ResourcesperPosition));
    lookup.addLookupField(fieldnum(CITStaffPlanLinesTable, TotalRequest));
    lookup.addLookupField(fieldnum(CITStaffPlanLinesTable, RecID),true);
    lookup.performFormLookup();
}

-Harry

No comments:

Post a Comment

Thanks