AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 08.06.2011, 21:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,631 / 848 (80) +++++++
Регистрация: 28.10.2006
dax-lessons: SysLookupMultiSelectCtrl in Dynamics AX 6.0 [AX 2012, X++]
Источник: http://dynamicsaxgyan.wordpress.com/...6-0-ax-2012-x/
==============

Friends,

I was going through some of the new objects/classes which have been introduced in AX 6.0 and found this class SysLookupMultiSelectCtrl helpful, which will serve multi selection in the grid lookup control.

I still remember we had to work around in 5.0 to attain this kind of functionlaity of getting the data from multiple datasources in lookups and adding columns accordingly.

Well in 6.0 – It’s very easy to implement using SysLookupMultiSelectCtrl class.

Below are the steps on how to achieve this :

1) Create a new Query by name CustTableLookup in the AOT >> Queries. Add 2 data sources [In the below example : I have added CustTable and CustTrans as datasources and linked these datasources by setting up relations property to Yes in CustTrans datasource]

2) Please remove fields which dont want to be queried on or donot want in the lookup columns by setting the dynamic peroperty to No on the fields in the datasource and by deleting unwanted fields to be selected.

Please find the screen shot below for reference.



3) Create a new form in the AOT >> Forms and give a meaningful Name – [I have named it as SR_LookupMultiSelectGrid]

Add a simple string control in the design and Name it as CustAccount and set the autodeclaration property to Yes as we are going to use this control in the X++ code within the form. [Refer screen shot below]


Now please write/override the following methods and copy paste the code

In the classDeclaration

X++:
public class FormRun extends ObjectRun
{
SysLookupMultiSelectCtrl msCtrl;
}
Override the init() method on the element and instantiate the SysLookupMultiSelectCtrl by passing the element , control in which you want the lookup and the Query to get the lookup data

X++:
public void init()
{
super();
SysLookupMultiSelectCtrl::construct(element, CustAccount, querystr(CustTablelookup));
}
Finally override the task() method and copy paste the below logic

X++:
public int task(int _taskId)
{
#task
int ret;

ret = super(_taskId);

if (ret && _taskId == #TaskSave)
{
// Call appropriate saving here…
msCtrl.get(); // get the Returned Ids
}

return ret;
}
Thats it. We are done. Now let’s ee how lookup looks like and how to select the mutliple items in the lookup and the selected values are returned in to the String control. Below screen shot for reference, Notice that in the lookup we have got the fields from different tables and data is filtered accordingly and also we have provision of selecting multiple rows in the lookup [check box ] provided and all you need to do is Mark the rows and click on Ok button
href=”http://dynamicsaxgyan.files.wordpress.com/2011/06/multiselect.jpg”>

Finally On clicking the Ok button – all the multi selected values will be set as a text in the string control as shown below.



For more information: Refer tutorial_LookupMultiSelectGrid
Next post will be on >> LookupMultiSelectDialog

Happy Dax 6ng

Sreenath

Источник: http://dynamicsaxgyan.wordpress.com/...6-0-ax-2012-x/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.

Последний раз редактировалось Poleax; 09.06.2011 в 10:43. Причина: оформление
Теги
ax2012, lookup

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
ax-erp: Creating SSRS-Reports in Dynamics AX 2012 – What’s no longer possible in AX-reports Blog bot DAX Blogs 0 18.07.2012 12:11
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
dynamics-ax: Interview with Microsoft's Lachlan Cash on his new role, AX 2012 and more Blog bot DAX Blogs 6 22.04.2011 14:55
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
daxdilip: Whats New in Dynamics AX 2012 (A brief extract from the recently held Tech Conf.) Blog bot DAX Blogs 7 31.01.2011 12:35

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 16:36.