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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 15.08.2007, 19:40   #1  
Blog bot is offline
Blog bot
Участник
 
25,617 / 848 (80) +++++++
Регистрация: 28.10.2006
axaptapedia: Go To Main Table
Источник: http://www.axaptapedia.com/Go_To_Main_Table
==============

Summary: New article, with dynamic Go To Main Table
==Introduction==

The '''Go to main table''' functionality is a very useful and commonly used method of navigating between forms inside Dynamics Ax.

By right-clicking on any control on a form which is bound to a table field, which in turn is based on an EDT which is a key to an Ax table, the user can select "Go to the Main Table Form" option which will open the "reference" form for that field.

For example, if the user is currently viewing a Sales Order, they can right-click on the Customer Account field, select "Go to the Main Table Form" and be taken directly to the customer form. The customer which was used on the Sales Order will be preselected in the new form.

==Standard functionality==

The standard functionality works in the following way:

''To be completed''

==Dynamic behaviour==

Sometimes we might want to modify the Go To Main Table functionality to be a little smarter.

We might, as an example, have two different forms which are used to show SalesTable records, as follows:
*Form SalesTable shows all records with the standard SalesTypes (with standard SalesTable menu item)
*Form AJNewSalesTable shows all records with the new SalesType AJNewType (with a new AJNewSalesTable menu item).

Each has a different filter applied to the SalesType field, to achieve the behaviour described.


We then want the Go To Main Table functionality to always go to the correct form, without having to program on every single Salesid control on every single form. We can do this by setting the FormReference field on the SalesTable to point to a class which redirects the request to the correct form.

Therefore we need to create a class (lets call it AJSalesTableMainTable) which will check the SalesType and open the correct form accordingly. We also need a Menu Item (also called AJRSalesTableMainTable for the example) pointing to that class. The FormReference property on the SalesTable table should then be set to RORSalesTableMainTable.

Now when a user does a Go To Main Table on SalesId, it runs our class, which then opens the correct form according to the SalesType! Obviously the class could do much more than this simple check if necessary. The class (shown below) needs only one method (main) which is enough to do the job. For clarity, no error checking is shown.


public static void main (Args _args)
{
SalesTable salesTable;
;

salesTable = SalesTable::find(_args.lookupValue());

switch (salesTable.SalesType)
{
case SalesType::AJNewSalesType : // Our added type

new MenuFunction(menuItemDisplayStr(AJNewSalesTable), MenuItemType::Display).run(_args); // New behaviour just for that type
break;

default : new MenuFunction(menuItemDisplayStr(SalesTable), MenuItemType::Display).run(_args); // Standard behaviour otherwise
break;
}
}



Источник: http://www.axaptapedia.com/Go_To_Main_Table
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
DeniZone: How to tell if a form was opened with 'Go to main table' function Blog bot DAX Blogs 0 17.02.2009 19:05
axaptapedia: Table Methods Generator Blog bot DAX Blogs 0 13.02.2009 02:05
Go to the main table option Blog bot DAX Blogs 0 02.07.2008 19:06
axaptapedia: Export a table to Excel Blog bot DAX Blogs 0 27.04.2007 11:10
axaptapedia: Export a table to Excel Blog bot DAX Blogs 0 12.04.2007 16:10

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

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

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