Hello:
I have a control on a custom form which I have a lookup method attached to return a select position Id. It works fine as-is. Clicking on the dropdown, I see the position Id, the worker first name, the worker last name, and I can filter on the individual fields. If I tab into the field, and start typing, I have to search based on the position Id. For efficiency sake, what I would like to do is as my user tabs through the fields on this form, when they get to the position they can type in the last name to filter the list, then select the appropriate record which should return the position id to my code rather than the last name.
What I've tried is changing the order of the fields so last name is first on the field selection. Typing in the last name now would filter the list as I want, but upon selecting the record, I get an error indicating no such position exists.
Hoping for some direction.
Edit:
The current code I'm using...
public void lookup()
{
Query query = new Query();
QueryBuildDataSource qbdsPSHcmPosWrkrView;
utcdatetime currDateTime = HcmDateTimeUtil::startOfCurrentDay();
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(psHcmPositionWorkerView), this);
sysTableLookup.addLookupField(fieldNum(psHcmPositionWorkerView, PositionId));
sysTableLookup.addLookupField(fieldNum(psHcmPositionWorkerView, Description));
sysTableLookup.addLookupField(fieldNum(psHcmPositionWorkerView, PersonnelNumber));
sysTableLookup.addLookupField(fieldNum(psHcmPositionWorkerView, FirstName));
sysTableLookup.addLookupField(fieldNum(psHcmPositionWorkerView, LastName));
qbdsPSHcmPosWrkrView = query.addDataSource(tableNum(psHcmPositionWorkerView));
qbdsPSHcmPosWrkrView.addOrderByField(fieldNum(psHcmPositionWorkerView, PositionId));
qbdsPSHcmPosWrkrView.addRange(fieldNum(psHcmPositionWorkerView, DirPersonName_ValidFrom)).value(queryRange(null, currDateTime));
qbdsPSHcmPosWrkrView.addRange(fieldNum(psHcmPositionWorkerView, DirPersonName_ValidTo)).value(queryRange(currDateTime, null));
qbdsPSHcmPosWrkrView.addRange(fieldNum(psHcmPositionWorkerView, HcmPositionWorkerAssignment_ValidFrom)).value(queryRange(null, currDateTime));
qbdsPSHcmPosWrkrView.addRange(fieldNum(psHcmPositionWorkerView, HcmPositionWorkerAssignment_ValidTo)).value(queryRange(currDateTime, null));
qbdsPSHcmPosWrkrView.addRange(fieldNum(psHcmPositionWorkerView, HcmPositionDetail_ValidFrom)).value(queryRange(null, currDateTime));
qbdsPSHcmPosWrkrView.addRange(fieldNum(psHcmPositionWorkerView, HcmPositionDetail_ValidTo)).value(queryRange(currDateTime, null));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
//super();
}