Display all/specific AOT tables in a lookup

For displaying all/specific AOT objects like tables in the lookup control, we need to iterate the UtilidElements table with our desired criteria.

static void lookupAOTTables(FormStringControl _ctrl)
{
SysTableLookup sysTableLookup =
SysTableLookup::newParameters(tablenum(UtilidElements), _ctrl);
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange nameQBR, typeQBR;
;
sysTableLookup.addLookupfield(fieldnum(UtilidElements, Name));
sysTableLookup.addLookupfield(fieldnum(UtilidElements, Id));

queryBuildDataSource = query.addDataSource(tablenum
(UtilidElements));

nameQBR = queryBuildDataSource.addRange(fieldnum(UtilidElements,
name));
nameQBR.value(‘Cust*’);

typeQBR = queryBuildDataSource.addRange(fieldnum(UtilidElements, recordType));
typeQBR.value(SysQuery::value(UtilElementType::Table));

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s