|
08.06.2011, 21:11 | #1 |
Участник
|
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; } X++: public void init() { super(); SysLookupMultiSelectCtrl::construct(element, CustAccount, querystr(CustTablelookup)); } 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; } 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 |
|
|