![]() |
#1 |
Участник
|
Malaysia: Using a form for building a lookup
Источник: http://axmas.blogspot.com/2012/11/us...ng-lookup.html
============== 1. In the AOT, create a new form named CustLookup. Add a new data source with the following properties: Property Value Name CustTable Table CustTable Index AccountIdx AllowCheck No AllowEdit No AllowCreate No AllowDelete No OnlyFetchActive Yes 2. Change the properties of the form's design as follows: Property Value Frame Border WindowType Popup 3. Add a new Grid control to the form's design, with the following properties: Property Value Name Customers ShowRowLabels No DataSource CustTable 4. Add a new StringEdit control to the grid, with the following properties: Property Value Name AccountNum AutoDeclaration Yes DataSource CustTable DataField AccountNum 5. Add a new ReferenceGroup control to the grid with the following properties, right after the AccountNum: Property Value Name Name DataSource CustTable ReferenceField Party 6. Add one more StringEdit control to the grid with the following properties, right after the Name: Property Value Name Phone DataSource CustTable DataMethod phone 7. Add a new ComboBox control with the following properties to the end of the Customers grid: Property Value Name Blocked DataSource CustTable DataField Blocked 8. Override the form's init() method with the following code: public void init() { super(); element.selectMode(AccountNum); } 9. Override the form's run() method with the following code: public void run() { FormStringControl callingControl; boolean filterLookup; callingControl = SysTableLookup::getCallerStringControl( element.args()); filterLookup = SysTableLookup::filterLookupPreRun(callingControl, AccountNum, CustTable_ds); super(); SysTableLookup::filterLookupPostRun(filterLookup, callingControl.text(), AccountNum, CustTable_ds); } 10. Finally, override the init() method of the CustTable data source with the following code: public void init() { Query query; QueryBuildDataSource qbds; QueryBuildRange qbr; query = new Query(); qbds = query.addDataSource(tableNum(CustTable)); qbr = qbds.addRange(fieldNum(CustTable,Blocked)); qbr.value(queryvalue(CustVendorBlocked::No)); this.query(query); } 11. The form in the AOT should look similar to the following screenshot: 12. Locate the CustAccount extended data type in the AOT, and change its property as follows: Property Value FormHelp CustLookup 13. To test the results, open Sales and marketing | Common | Sales orders | All sales orders, and start creating a new sales order. Notice that now the Customer account lookup is different, and it includes only active customers: Источник: http://axmas.blogspot.com/2012/11/us...ng-lookup.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|