Vasanth Arivali's Blog

Posts Tagged ‘lookups using x++

Hi All,

Here I create Lookups using X++ Code(without Ax Table or EDT relation). For that i override a String(Text) Control’ s lookup method.

public void lookup()

{
//super();

// Added by Vasanth Arivali

// Declaration
Query   LookupQuery    =   new Query();

QueryBuildDataSource     LookupQueryBuildDataSource;

QueryBuildRange                  LookupQueryBuildRange;
SysTableLookup CustomSysTableLookup =       SysTableLookup::newParameters(tableNum(InventTable), this);

;

// Add fields that you want in Lookups

CustomSysTableLookup.addLookupField(fieldNum(InventTable, ItemId));

CustomSysTableLookup.addLookupField(fieldNum(InventTable,ItemName));

CustomSysTableLookup.addLookupField(fieldNum(InventTable,ItemGroupId));

CustomSysTableLookup.addLookupField(fieldNum(InventTable,NameAlias));

CustomSysTableLookup.addLookupField(fieldNum(InventTable,ItemType));

CustomSysTableLookup.addLookupField(fieldNum(InventTable,DimGroupId));

// Add DataSource, Range and Value

LookupQueryBuildDataSource =

LookupQuery.addDataSource(tableNum(InventTable));

LookupQueryBuildRange=

LookupQueryBuildDataSource.addRange(fieldNum(InventTable,ItemVisibility));

LookupQueryBuildRange.value(queryValue(NOYESCOMBO::Yes));

// Execute the Query

CustomSysTableLookup.parmQuery(LookupQuery);

CustomSysTableLookup.performFormLookup();
// Added by Vasanth Arivali

}


Welcome

What’s happening?

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

Categories

Join 13 other followers