Tuesday, June 8, 2010

GROUPING query

if you want to group a query on a field, here is an example (used in a lookup table):

public void lookup()
{
    SysTableLookup        sysTableLookup = SysTableLookup::newParameters(tableNum(YourTable), this);
    Query                 query = new query();
    QueryBuildDataSource  queryBuildDataSource = query.addDataSource(tableNum(YourTable));
    ;

    queryBuildDataSource.orderMode(OrderMode::GROUPBY);
    queryBuildDataSource.addSortField(FieldNum(YourTable, YourField));

    sysTableLookup.addLookupfield(fieldNum(YourTable, YourField));
    sysTableLookup.parmQuery(query);

    sysTableLookup.performFormLookup();
}

No comments:

Post a Comment