hi ,
I have a problm on lookup method.
My problem is
There is a field “Last date worked” from table hcm, I have to list out the employee id from the table hcm , Which are the employee id’s Last date worked is greater than today date;
hi ,
I have a problm on lookup method.
My problem is
There is a field “Last date worked” from table hcm, I have to list out the employee id from the table hcm , Which are the employee id’s Last date worked is greater than today date;
you have to write the custom lookup. It will be better to write custom lookup at the table level and override the lookup method from field of the datasource in the form.
Like you have to add below method in the hcmtable
public void lookupHCMtable(FormStringControl _ctrl)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(hcmtable), _ctrl);
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
;
sysTableLookup.addLookupfield(fieldnum(hcmtable, EmpId));
sysTableLookup.addLookupfield(fieldnum(hcmtable, EmpName));
queryBuildDataSource = query.addDataSource(tablenum(hcmtable));
queryBuildRange = queryBuildDataSource.addRange(fieldnum(hcmtable, Lastdateworked));
queryBuildRange.value(strFmt(’(Lastdateworked > %1)’, today()));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Now override the lookup method from the field of the datasource on which you would like to display the lookup.
public void lookup(FormControl _formControl, str _filterStr)
{
hmctable.lookupHCMtable(_formControl);
}
With Best Regards,
Nasheet Ahmed Siddiqui | Dynamics AX Technical Consultant
Blog : http://nasheet.wordpress.com
I think we have to make change in the below line for Ax5.0
queryBuildRange.value(strFmt(’(Lastdateworked > %1)’, date2strxpp(today)));
And why we are using the date2strxpp,
I got the output by using the date2strxpp, What is the difference between these two by using date2strxpp and without using date2strxpp