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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 29.08.2007, 16:30   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
axaptapedia: Display method
Источник: http://www.axaptapedia.com/Display_method
==============

Summary:
for description of [[display method]] go to [http://msdn2.microsoft.com/EN-US/library/aa595058.aspx MSDN]

=== Limitations ===
[[display method]] behaves line in an ordinary field but have some limitations:
*it's data can not be chenged (use [[edit method]] inestead)
*you can not fiter and sort by display method

If you need to sort and filter by display method's data, there is a following workarounds
1. Replace a display method with an ordinary stored field
2. Replace a display method with inner joined table.

The last is applicable if you have an often situation when display method simply returns a fielad value of the related table by '''mandatory''' field.

for exmaple, you have a display method on the table named YourTable like the following:

display EmplName emplName()
{
return EmplTable::find(this.EmplID).Name;
}


if YourTable.emplID is mandatory, you can use inner join instead of this display method:
1. Place additional datasource on your form for EmplTable.
2. Set [[LinkType property]] to 'InnerJoin'
3. Add 'Name' field of the created EmplTable datasource to your [[Grid control]] or ehanever else

If your original datasouce is read only, your job is done.
In other case, when you try to add a new record to the datasource, you will see an error about mandatory fields of EmplTable. This error occurs because Ax tries to save joined datasource.
To prevent such behavoiur, you should

4. Overridde the [[write method]] of the EmplTable datasource with an empty implementation to prevent wtiting data to the table

public void write()
{
// 'super' is commented out:
// super();
}


5. Override the [[validateWrite method]] of this datasource to prevent error messages:

public boolean validateWrite()
{
boolean ret;
;
//ret = super();
ret = true;
return ret;
}


Now you can filter and sort your datasource by employee full name.


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

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axaptapedia: RunBaseBatch Blog bot DAX Blogs 0 04.04.2009 22:05
axaptapedia: RunBaseBatch Blog bot DAX Blogs 0 31.03.2009 06:06
TwC: Validate access to return value from display/edit method. HorrR DAX: Программирование 10 05.03.2008 12:17
TwC: Validate access to return value from display/edit method. алька DAX: Программирование 3 20.04.2007 14:15
display() method on Grid Control DK DAX: Программирование 5 31.01.2003 22:09
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 22:45.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.