In the dynamics ax 2012, there
are different ways to fill the combo box/drop down list
This above method of lookup was
heavily used in AX 2009, and it also used in the AX 2012 when there isn’t any data
source specified in the form (i.e. Dialog Form) and the StringEdit control used
for the lookup
How to create a simple lookup
The SysTableLookup class is provided by the standard application to allow
programmers to easily create their own lookup forms, in code.
The basic steps to using this class are as follows:- Create the sysTableLookup object
- Create the query to select the lookup data
- Add the fields shown on the lookup
- Performs the lookup
client static
void lookup<TableName> (FormStringControl
_ctrl)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(<tableName>),_ctrl);
Query query = new Query();
// create
the query for the lookup
QueryBuildDataSource queryBuildDataSource =
query.addDataSource(tableNum(<tableName>));
// Add
fields that will be shown in the lookup as columns
sysTableLookup.addLookupfield(fieldNum(<tableName>,<FeildName1>));
sysTableLookup.addLookupfield(fieldNum(<tableName>,<FeildName2>));
//Add
the query to the lookup form
sysTableLookup.parmQuery(query);
// Perform the lookup
sysTableLookup.performFormLookup();
}
|
How to create a simple lookup Reference
The SysReferenceTableLookup class is used
to construct lookup forms for reference controls.
- Create the SysReferenceTableLookup object
- Create the query which will be used to select the lookup data
- Add the fields which will be shown on the lookup
- Perform the lookup
public static
client <tableName> lookup<tableName>(
FormReferenceControl _formReferenceControl)
{
Query query;
SysReferenceTableLookup
referenceLookup;
if
(_formReferenceControl == null)
{
throw
error(Error::missingParameter(null));
}
referenceLookup =
SysReferenceTableLookup::newParameters(
tableNum(<tableName>),
_formReferenceControl,
true);
// create
the query for the lookup form
query.addDataSource(tableNum(<tableName>));
// Add
fields that will be shown in the lookup form as columns
referenceLookup.addLookupfield(fieldNum(<tableName>,<FeildName1>));
referenceLookup.addLookupfield(fieldNum(<tableName>,<FeildName2>));
// Add the
query to the lookup form
referenceLookup.parmQuery(query);
// Perform
the lookup and return the selected record
return
referenceLookup.performFormLookup() as
<tableName>;
}
|
the post is great start but i would like to ask some thing is there a way to add range on the method i have added in my lookup can you please help me with this
ReplyDeleteZainab, you can create the customized lookup, you can update the signature of lookup method in the table and can use the QueryBuildRange object to add the range in the lookups.
ReplyDeleteThank you Arslan but what i want to do is that i have created a lookup in which i have added few fields and some methods now i want to add range on the values of the field which are generated by the method where as i can only add fieldnum using following code
DeletesysTableLookup.addLookupfield(fieldNum(InventTable,ItemId));
sysTableLookup.addLookupMethod("itemName");
sysTableLookup.addLookupMethod("SalesStatus");
instead of this line i want to add the method and run my range on this is it possible
queryBuildDataSource.addRange(fieldNum(InventTable,ItemId));
Afyon
ReplyDeleteBalıkesir
Kırklareli
Amasya
Bilecik
PB2B
ığdır evden eve nakliyat
ReplyDeleteağrı evden eve nakliyat
maraş evden eve nakliyat
diyarbakır evden eve nakliyat
şırnak evden eve nakliyat
GWFW2U
385BB
ReplyDeleteEskişehir Evden Eve Nakliyat
Erzincan Evden Eve Nakliyat
Tunceli Parça Eşya Taşıma
Pursaklar Fayans Ustası
Kayseri Parça Eşya Taşıma
Kayseri Lojistik
Ünye Oto Elektrik
Silivri Duşa Kabin Tamiri
Çerkezköy Oto Lastik
66A6B
ReplyDeletebinance %20 komisyon indirimi
5934F
ReplyDeletereferans
37E51
ReplyDeleteThreads İzlenme Hilesi
Pitbull Coin Hangi Borsada
Bitcoin Nedir
Soundcloud Dinlenme Hilesi
Alya Coin Hangi Borsada
Soundcloud Dinlenme Satın Al
Binance Referans Kodu
Onlyfans Beğeni Hilesi
Görüntülü Sohbet
THUYTJU
ReplyDeleteشركة مكافحة الفئران بالاحساء
شركة عزل اسطح بالخرج lhpJb6g1D4
ReplyDeleteشركة رش حشرات بالاحساء hupPKOXgzC
ReplyDeleteنفخ المجاري بالاحساء E5voddVh0O
ReplyDeleteشركة مكافحة حشرات بالاحساء kwBhAaVL6s
ReplyDeleteشركة عزل اسطح بالاحساء H57KBcUHKr
ReplyDeleteشركة تسليك مجاري بخميس مشيط fOqIKVX8jQ
ReplyDeleteشركة تنظيف افران
ReplyDeleteu8yhqVb