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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 09.04.2008, 00:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
gatesasbait: Deleting of a Set of RecIds from multiple tables
Источник: http://gatesasbait.spaces.live.com/B...B9F5!203.entry
==============


Good afternoon,

I use the following code when coding test cases. It allows me to create records, and delete them without having to manage every one separately. Inside my *test methods, I put the following set declaration and nested methods (I make sure to call deleteAll() even if an error was thrown during code execution):

X++:
 public void aTestMethodTest()
 {
     Set recSet = new Set(Types::Container);
  
     void insert(Common _common)
    {
        _common.doInsert();
        recSet.add([_common.TableId, _common.RecId]);
    }
    void deleteAll()
    {
        SetEnumerator setEnum = recSet.getEnumerator();
        SysDictTable sysDictTable;
        Common temp;
        RecId recId;
        TableId tableId;
         while (setEnum.moveNext())
        {
            [tableId, recId] = setEnum.current();
            sysDictTable = new SysDictTable(tableId);
            temp = sysDictTable.makeRecord();
            select firstonly forupdate RecId
                from temp
                where temp.RecId == recId;
            ttsbegin;
            temp.doDelete();
            ttscommit;
        }
     }
     ;
  
     //(...) actual test case test code here
}
Источник: http://gatesasbait.spaces.live.com/B...B9F5!203.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
msdynamicsax: selecting data from multiple companyaccounts Blog bot DAX Blogs 0 28.08.2008 15:05
gatesasbait: System-generated find() and exist() methods on tables Blog bot DAX Blogs 0 06.08.2008 00:05
gatesasbait: Automatic creation of a PDF from a customer invoice in Dynamics Ax 4.0 Blog bot DAX Blogs 0 28.04.2008 19:05
Вопрос про Demand Planner slava09 DAX: Функционал 4 25.09.2006 11:43
Говорят вышел SP2 для Axapta 3. Кто нибуть что знает на эту тему? soin DAX: Прочие вопросы 10 13.10.2003 10:43

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

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

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