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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 11.11.2009, 16:57   #12  
lev is offline
lev
Ищущий знания...
Аватар для lev
Oracle
MCBMSS
Axapta Retail User
 
1,723 / 491 (20) +++++++
Регистрация: 18.01.2005
Адрес: Москва
может кому пригодиться ради спортивного интереса создал у себя следующее:
1. В классе SysDictTable метод find():
X++:
static Common find(TableId  _tableId, RefRecId  _recId, boolean _forUpdate = false)
{
    Common      common;
    DictTable   dictTable;
    ;

    if (_recId != 0)
    {
        dictTable   = new DictTable(_tableId);
        common = dictTable.makeRecord();

        common.selectForUpdate(_forUpdate);

        select firstOnly common
            where common.RecId  == _recId;
    }

    return common;
}
2. Job для теста метода:
X++:
static void testFindCommon(Args _args)
{
    InventTable inventTable;
    Common      common;
    ;

    select firstonly inventTable;
    // без forUpdate -->
    common  = SysDictTable::find(inventTable.TableId, inventTable.RecId);

    info(strFmt('До update - %1', common.(fieldNum(InventTable, ItemId))));
    // без forUpdate <--

    // с forUpdate -->
    ttsbegin;

    common  = SysDictTable::find(inventTable.TableId, inventTable.RecId, true);
    common.(fieldNum(InventTable, ItemId)) = common.(fieldNum(InventTable, ItemId)) + 'Тест';
    common.doUpdate();

    ttscommit;

    info(strFmt('После update - %1', common.(fieldNum(InventTable, ItemId))));
    // с forUpdate <--
}
__________________
"Страх перед возможностью ошибки не должен отвращать нас от поисков истины." (с)
С Уважением,
Елизаров Артем
За это сообщение автора поблагодарили: 3oppo (1), propeller (1).
Теги
common, find, exists

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
To find objects in AOT with particular properties Blog bot DAX Blogs 1 26.04.2008 07:33
Kashperuk Ivan: Hotkeys and Find vs Filter in Dynamics AX 2009 Blog bot DAX Blogs 2 11.03.2008 12:06
Inside Dynamics AX 4.0: Common Search Blog bot DAX Blogs 0 29.10.2007 10:50
daxmy: AOT Find function Blog bot DAX Blogs 0 17.08.2007 01:23
Dynamics AX Geek: cross-references & find Blog bot DAX Blogs 0 28.10.2006 16:40

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

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

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