hello all,
I want Emloyee id to be stored in table and want to display employee name on form. so i tried following method.
- i had created lookup using following code
SysMultiTableLookup sysTableLookup;
Query query;
QueryBuildDataSource qbdsHcmWorker,qbdsDirPerson;
;
query=new Query();
qbdsHcmWorker=query.addDataSource(tableNum(HcmWorker));
qbdsDirPerson=qbdsHcmWorker.addDataSource(tableNum(DirPerson));
qbdsDirPerson.relations(true);
qbdsDirPerson.fetchMode(QueryFetchMode::One2One);
sysTableLookup = SysMultiTableLookup::newParameters(_formControl,query);
sysTableLookup.addLookupfield(fieldnum(HcmWorker,personnelNumber),1);
sysTableLookup.addLookupfield(fieldnum(DirPerson, Name),2);
sysTableLookup.performFormLookup();
So it will display me emp_id and name on my lookup. lookup is displaying perfect.
- Now I want to store Empid in table but want to display Name on form level so i had written following code in edit method of data source and applied this method as a data method on form control.
public edit DirPartyName editApproverId(boolean _set,GBIRulesGroupTable _GBIRulesGroupTable,HcmPersonnelNumberId _EmpId)
{
HcmWorker hcmWorker;
DirPartyName partyName;
;
hcmWorker=HcmWorker::findByPersonnelNumber(_EmpId);
//BP deviation documented
if(_set)
{
mytable.myfield=_EmpId
}
partyName= DirPerson::find(hcmWorker.Person).Name;
return partyName;
}
from my hand it is looking fine. but problem is it is not storing,displaying any value for field. And when i select values from lookup i am not able to see on form.