Filter/Sort Tree Control (Lookup)

Hello Everybody,

If anybody has an idea as how I can proceed with having a Filter, Ascending/Descending Sort as how we generally have in dropdown/lists, please share with me.

Eg: ProductGroupLookup form which is used in PurchReqAddItem under Category field for Non-catalogue items - AX 2009

I have been struggling to do this and just found myself in a confused critical situation.

Thanks in advance.

Regards,

Jay

Hi Jayanthi,

try this …

static client void my_Lookup(FormStringcontrol _ctrl)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(myTable), _ctrl);
Query query;
QueryBuildDataSource qbds;

;

sysTableLookup.addLookupfield(fieldnum(myTable,periodId));
sysTableLookup.addLookupfield(fieldnum(myTable,name));
sysTableLookup.addLookupfield(fieldnum(myTable,startingDate));
sysTableLookup.addLookupfield(fieldnum(myTable,endingDate));

query = new Query();

qbds = query.addDataSource(tablenum(myTable));
// qbds.clearRanges();
qbds.addSortField(fieldnum(myTable,startingDate),sortOrder::Descending);

qbds.addRange(fieldnum(myTable,endingDate)).value(SysQuery::valueEmptyString());
qbds.addRange(fieldnum(myTable,endingDate)).value(queryRange(today(),0));

sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}

Thanks,

Valeru.

Hi Valeru,

I am asking to sort a tree control like AOT in descending order. I know what you gave works for grids, lookups, etc.

But how to build a tree in reverse order? :0

Hi Jayu,

Pls Chk your Conversation Inbox.

-Rajee