首页 > 代码库 > 标准Lookup中使用Group By 过滤数据
标准Lookup中使用Group By 过滤数据
public void lookup()
{
SysTableLookup sysTableLookup;
Query Query = new Query();
QueryBuildDataSource qbds;
;
OfStaffingTable.JobId = ""; // Field置空,防止Field有值时下拉GroupBy失败。
OfStaffingTable_JobId.text("");
sysTableLookup = SysTableLookup::newParameters(tableNum(HRPPartyPositionTableRelationship),this);
sysTableLookup.addLookupfield(fieldNum(HRPPartyPositionTableRelationship, JobId));
sysTableLookup.addLookupfield(fieldNum(HRPPartyPositionTableRelationship, JobName));
qbds = Query.addDataSource(tableNum(HRPPartyPositionTableRelationship));
qbds.orderMode(OrderMode::GroupBy);
qbds.addSelectionField(fieldnum(HRPPartyPositionTableRelationship,JobId),SelectionField::Database);
qbds.addSortField(fieldnum(HRPPartyPositionTableRelationship,JobId));
qbds.addSelectionField(fieldnum(HRPPartyPositionTableRelationship,JobName),SelectionField::Database);
qbds.addSortField(fieldnum(HRPPartyPositionTableRelationship,JobName));
qbds.addRange(fieldnum(HRPPartyPositionTableRelationship,OrganizationUnitId)).value(queryvalue(OfStaffingTable.OrganizationUnitId));
sysTableLookup.parmQuery(Query);
sysTableLookup.performFormLookup();
}
标准Lookup中使用Group By 过滤数据