Lookup from multiple table ax 2009 :
Lookup from multiple table ax 2009
SysMultiTableLookup xpo
First import above xpo(on own risk),because its contains system class.
First Take Xpo from following Link after it write code where you want to use multitable lookup in ax 2009
public void lookup()
{
Query query = new Query();
QueryBuildDataSource qbdsItem;
QueryBuildDataSource qbdsInventTableModule,qbdsInvent;
QueryBuildDataSource qbdsInventItemLocation;
QueryBuildRange qbrModuleType;
SysMultiTableLookup sysTableLookup;
;
qbdsItem = query.addDataSource(tableNum(prodBom));
qbdsInventTableModule = qbdsItem.addDataSource(tableNum(inventdim), "Purch");
qbdsInventTableModule.relations(true);
if(S3RejectionLine_ProdId.valueStr())
{
qbdsItem.addRange(fieldnum(prodBom,Prodid)).value(RejectionLine_ProdId.valueStr());
}
qbdsInventTableModule.fetchMode(QueryFetchMode::One2One);
sysTableLookup = SysMultiTableLookup::newParameters(this, query);
sysTableLookup.addLookupField(fieldNum(prodBom, recid));
sysTableLookup.addLookupField(fieldNum(prodBom, ItemId),1,false,'Itemid');
sysTableLookup.addLookupMethod('ItemName',1,'ItemName');
sysTableLookup.addLookupField(fieldNum(inventdim, InventSizeId), 2, false, "InventSizeId");
sysTableLookup.addLookupField(fieldNum(inventdim, InventLocationId), 2,false,"InventLocationId");
sysTableLookup.addLookupField(fieldNum(inventdim, configId), 2,false,"configId");
sysTableLookup.performFormLookup();
}
===============================================================
public void lookup()
{
QueryBuildDataSource queryBuildDataSource;
SysTableLookup lookup;
QueryBuildRange queryBuildRange;
Query query;
query = new Query();
// Add the first data source to the query
queryBuildDataSource = query.addDataSource(tableNum(JournalizingDefinition));
// Add the range to this first data source
queryBuildRange = queryBuildDataSource.addRange(fieldNum(JournalizingDefinition, JournalizingDefinitionModuleValue));
// Set the range
queryBuildRange.value(enum2str(JournalizingDefinitionModuleId::GeneralLedger));
lookup = SysTableLookup::newParameters(tableNum(JournalizingDefinition), this, true);
lookup.parmQuery(query);
// Add the fields to be shown in the lookup form.
lookup.addLookupfield(fieldNum(JournalizingDefinition, JournalizingDefinitionCode));
lookup.addLookupfield(fieldNum(JournalizingDefinition, JournalizingDefinitionDesc));
lookup.addLookupfield(fieldNum(JournalizingDefinition, JournalizingDefinitionModuleValue));
// Perform the lookup.
lookup.performFormLookup();
}
--------------------------------------------------
public void lookup(FormControl _formControl, str _filterStr)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(ProdBOM), _formControl);
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
;
sysTableLookup.addLookupField(fieldnum(ProdBOM, itemid));
sysTableLookup.addLookupMethod('itemName');
qbds = query.addDataSource(tablenum(ProdBOM));
if(Rejection_ProdId.valueStr())
{
qbds.addRange(fieldnum(ProdBOM, prodid)).value(Rejection_ProdId.valueStr());
}
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Note : Lookup can be created by
1) By Relations
2) By Method
3) By EDT
4) By AutoLookup
5) By TitleField1 and TitleField2
First import above xpo(on own risk),because its contains system class.
First Take Xpo from following Link after it write code where you want to use multitable lookup in ax 2009
public void lookup()
{
Query query = new Query();
QueryBuildDataSource qbdsItem;
QueryBuildDataSource qbdsInventTableModule,qbdsInvent;
QueryBuildDataSource qbdsInventItemLocation;
QueryBuildRange qbrModuleType;
SysMultiTableLookup sysTableLookup;
;
qbdsItem = query.addDataSource(tableNum(prodBom));
qbdsInventTableModule = qbdsItem.addDataSource(tableNum(inventdim), "Purch");
qbdsInventTableModule.relations(true);
if(S3RejectionLine_ProdId.valueStr())
{
qbdsItem.addRange(fieldnum(prodBom,Prodid)).value(RejectionLine_ProdId.valueStr());
}
qbdsInventTableModule.fetchMode(QueryFetchMode::One2One);
sysTableLookup = SysMultiTableLookup::newParameters(this, query);
sysTableLookup.addLookupField(fieldNum(prodBom, recid));
sysTableLookup.addLookupField(fieldNum(prodBom, ItemId),1,false,'Itemid');
sysTableLookup.addLookupMethod('ItemName',1,'ItemName');
sysTableLookup.addLookupField(fieldNum(inventdim, InventSizeId), 2, false, "InventSizeId");
sysTableLookup.addLookupField(fieldNum(inventdim, InventLocationId), 2,false,"InventLocationId");
sysTableLookup.addLookupField(fieldNum(inventdim, configId), 2,false,"configId");
sysTableLookup.performFormLookup();
}
===============================================================
public void lookup()
{
QueryBuildDataSource queryBuildDataSource;
SysTableLookup lookup;
QueryBuildRange queryBuildRange;
Query query;
query = new Query();
// Add the first data source to the query
queryBuildDataSource = query.addDataSource(tableNum(JournalizingDefinition));
// Add the range to this first data source
queryBuildRange = queryBuildDataSource.addRange(fieldNum(JournalizingDefinition, JournalizingDefinitionModuleValue));
// Set the range
queryBuildRange.value(enum2str(JournalizingDefinitionModuleId::GeneralLedger));
lookup = SysTableLookup::newParameters(tableNum(JournalizingDefinition), this, true);
lookup.parmQuery(query);
// Add the fields to be shown in the lookup form.
lookup.addLookupfield(fieldNum(JournalizingDefinition, JournalizingDefinitionCode));
lookup.addLookupfield(fieldNum(JournalizingDefinition, JournalizingDefinitionDesc));
lookup.addLookupfield(fieldNum(JournalizingDefinition, JournalizingDefinitionModuleValue));
// Perform the lookup.
lookup.performFormLookup();
}
--------------------------------------------------
public void lookup(FormControl _formControl, str _filterStr)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(ProdBOM), _formControl);
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
;
sysTableLookup.addLookupField(fieldnum(ProdBOM, itemid));
sysTableLookup.addLookupMethod('itemName');
qbds = query.addDataSource(tablenum(ProdBOM));
if(Rejection_ProdId.valueStr())
{
qbds.addRange(fieldnum(ProdBOM, prodid)).value(Rejection_ProdId.valueStr());
}
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Note : Lookup can be created by
1) By Relations
2) By Method
3) By EDT
4) By AutoLookup
5) By TitleField1 and TitleField2
0 comments:
Post a Comment