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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 15.08.2006, 14:23   #5  
RVS is offline
RVS
Сенбернар
Аватар для RVS
Злыдни
 
696 / 130 (6) +++++
Регистрация: 27.02.2003
Адрес: Королев МО
Источник : Axapta - Руководство разработчика. Поиск по слову lookup

Creating a run-time lookup form
A standard lookup form is created through relations on the database table, and on the Extended Data Type. To learn about the standard lookup form, click ...

If, however, you need to create a runtime lookup form that looks up other database fields than the ones offered by the standard lookup form, use the application class SysTableLookup and override the lookup method on the relevant form control.

How to use the SysTableLookup class


Create a new instance of SysTableLookup where 'this' is the current form control

SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(custTable), this);

Add the fields to be shown in the lookup form

sysTableLookup.addLookupField(fieldNum(custTable, accountNum));

Limit the data selection.

queryBuildDataSource = query.addDataSource(tableNum(custTable));

queryBuildRange = queryBuildDataSource.addRange(fieldNum(custTable, accountNum));

queryBuildRange.value('A..B');

sysTableLookup.parmQuery(query);

Perform the lookup, and delete super().
super() will create an autogenerated lookup form.

sysTableLookup.performFormLookup();

// super()

}



A complete example of overriding the lookup method on a form control


void lookup()

{

Query query = new Query();

QueryBuildDataSource queryBuildDataSource;

QueryBuildRange queryBuildRange;



// Create an instance of SysTableLookup where 'this' the current Form control.



SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(custTable), this);

;



// The field to be shown in the lookup form.



sysTableLookup.addLookupField(fieldNum(custTable, accountNum));

sysTableLookup.addLookupField(fieldNum(custTable, name));



// Limit and arrange data selection.



queryBuildDataSource = query.addDataSource(tableNum(custTable));

queryBuildRange = queryBuildDataSource.addRange(fieldNum(custTable, accountNum));

queryBuildRange.value('A..B')
;

sysTableLookup.parmQuery(query);



// Perform lookup



sysTableLookup.performFormLookup();



// do not call super().



// super()

}











void lookup()

{

Query query = new Query();

QueryBuildDataSource queryBuildDataSource;

QueryBuildRange queryBuildRange;

SysTableLookup sysTableLookup;

TableId tableId;

FieldId fieldId;

;

tableId = tablename2id('myTable');

sysTableLookup.parmTableId(tableId);

fieldId = fieldname2id(tableId, 'MyField_1');

sysTableLookup.addLookupfield(fieldId);

fieldId = fieldname2id(tableId, 'MyField_2');

sysTableLookup.addLookupfield(fieldId);



queryBuildDataSource = query.addDataSource(tableId);

queryBuildDataSource.orderMode(OrderMode::GROUPBY);

queryBuildDataSource.addSortField(fieldId));



sysTableLookup.parmQuery(query);



this.performFormLookup(sysTableLookup.formRun());

}

This manner of creating a lookup form is used in the DocuType form in the application. The full path to the modified lookup method is:

\Forms\DocuType\Designs\Design\[Tab:Tab]\[TabPage:Overview]\[Grid:Grid]\StringEdit:ActionClassName\Methods.

Note
The SysTableLookup is limited to making lookups on fields in a table.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
gatesasbait: How to define a custom lookup form for an extended datatype Blog bot DAX Blogs 0 09.07.2008 22:05
Создание Lookup формы Maxim Gorbunov DAX: База знаний и проекты 9 26.06.2007 16:44
Фильтрация в lookup labuzov DAX: Программирование 2 08.07.2004 14:32
Фильтрация в Lookup-форме Rem DAX: Программирование 5 27.04.2002 08:27
Динамические Lookup формы. Андрей Василюк DAX: База знаний и проекты 0 07.12.2001 07:07
Опции темы Поиск в этой теме
Поиск в этой теме:

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

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

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

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