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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 16.04.2007, 23:51   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
Harish Mohanbabu: Table set / get properties
Источник: http://harish-m.livejournal.com/24306.html
==============
Ever since I changed job, it has been a busy period. Any way one of the questions I have noticed often is about setting and getting table properties by X++. This can be accomplised by using 'TreeNode' class. Here are some examples -

Get table properties
Let us say we want to get 'Security key' table property for all tables. Here is a sample code -

X++:
static void getTableProperty(Args _args)
{
/*
    Author      :       Harish Mohanbabu
    Date        :       April 16, 2007
    Purpose     :       To obtain table properties
*/

    #AOT
    str             Property;
    TreeNode        TreeNode;
    identifiername  identifiername;
    str             Name;
    ;

    TreeNode    = TreeNode::findNode(#TablesPath);
    TreeNode    = TreeNode.AOTfirstChild();
    while (TreeNode)
        {
            Name = TreeNode.AOTname();
            Property       = TreeNode.AOTgetProperties();
            identifiername = findproperty(Property, 'SecurityKey');
            info (strfmt("%1, %2", Name, identifiername));
            treenode = TreeNode.AOTnextSibling();
        }
}
Set table properties
Let us say we want to set 'modified date' table property to yes for all 'CustTable'.

......................................................
X++:
static void setTableProperty(Args _args)
{
/*
    Author     :       Harish Mohanbabu
    Date       :       April 16, 2007
    Purpose    :       To obtain table properties
*/

    str                Property;
    TreeNode    TreeNode;
    str               Name;
    ;
    
    Name = "CustTable";
    TreeNode  = TreeNode::findNode("Data Dictionary\\Tables\\" + Table);
    if (TreeNode)

           ttsbegin;
           Property       = TreeNode.AOTgetProperties();
           Property       = SetProperty(Property, "ModifiedDate", "Yes");
           TreeNode.AOTsetProperties(Property);
           TreeNode.AOTcompile();
           TreeNode.AOTsave();
        }
}
Note - if you are planning to use the above code, please make sure you first do this in a test environment.


==============
Источник: http://harish-m.livejournal.com/24306.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Старый 17.04.2007, 09:23   #2  
mazzy is offline
mazzy
Участник
Аватар для mazzy
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
29,472 / 4494 (208) ++++++++++
Регистрация: 29.11.2001
Адрес: Москва
Записей в блоге: 10
Цитата:
Сообщение от Blog bot Посмотреть сообщение
Note - if you are planning to use the above code, please make sure you first do this in a test environment.[/SIZE][/FONT]
Абсолютно согласен!

Кроме того, обратите внимание, что модификации таблиц будут выполнены в том слое, из-под которого запускается данный код. Т.е. если разработчик сидит в cus, а код запустился пользователем из-под usr, то поля появятся в usr.
__________________
полезное на axForum, github, vk, coub.
Старый 17.04.2007, 15:28   #3  
belugin is offline
belugin
Участник
Аватар для belugin
Сотрудники Microsoft Dynamics
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии 2011
Лучший по профессии 2009
 
4,622 / 2925 (107) +++++++++
Регистрация: 16.01.2004
Записей в блоге: 5
Еще:
*надо бы игнорировать системные таблицы
*если после прогона скрипта не синхронизироваться а выйти, то потом не войдешь
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Harish Mohanbabu: Hardware sizing guides for Ax 2009? Blog bot DAX Blogs 0 12.10.2008 14:07
Harish Mohanbabu: Survey on .NET Business Connector for Partners Blog bot DAX Blogs 0 24.06.2008 18:05
Harish Mohanbabu: Inside Microsoft Dynamics Ax 4.0 - Free eBook! Blog bot DAX Blogs 0 16.04.2008 15:05
axStart: Mass update on table properties Blog bot DAX Blogs 0 15.12.2007 01:11
Harish Mohanbabu: Axapta 3.0 compilation errors Blog bot DAX Blogs 0 14.06.2007 22:14

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

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

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