LOOKUP FILTERS

Dear Pioneers,

I have to show PRODUCTION ORDERS in LOOKUP, In TRANSFER ORDER Form, In PRODUCTION ID, and it should show only the ESTIMATED & REPORT AS FINISHED production ids only in AX2009.

I wrote the code as below :

public void lookup(FormControl _formControl, str _filterStr)

{

// super(_formControl, _filterStr);

Query query = new Query();

QueryBuildDataSource queryDataSourceCode;

QueryBuildRange queryBuildRange,queryBuildRange1,queryBuildRange2;

SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(ProdTable), _formControl);

;

sysTableLookup.addLookupField(fieldNum(ProdTable, ProdId));

queryDataSourceCode = query.addDataSource(tableNum(ProdTable));

queryBuildRange = queryDataSourceCode.addRange(fieldNum(ProdTable, ProdStatus));

queryBuildRange.value(enum2str(ProdStatus::StartedUp));

queryDataSourceCode.addSortField(fieldnum(ProdTable,ProdId),sortOrder::Ascending);

queryBuildRange2 = queryDataSourceCode.addRange(fieldNum(ProdTable, ProdStatus));

queryBuildRange2.value(enum2str(ProdStatus::ReportedFinished));

queryDataSourceCode.addSortField(fieldnum(ProdTable,ProdId),sortOrder::Ascending);

sysTableLookup.parmQuery(query);

sysTableLookup.performFormLookup();

}

Please suggest me, that IS IT NECESSARY TO WRITE A SEPARATE queryBuildRange2.value FOR REPORTASFINISHED ALSO ??

Need your suggestions Pioneers…

Hi,

You defined 2 ranges on the same field, you can try to define one range like follows:

QueryBuildRange.value(strfmt("%1,%2",enum2str(ProdStatus::ReportedFinished),enum2str(ProdStatus::StartedUp)));

you can also set the sorting before the range definition

Hope it helps, please verify the solution if it solves your problem.

regards,

Thomas

Thanks A Lot