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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 22.07.2010, 19:06   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
paruvella: Insert the De-Serialized XML file values into Ax-Table
Источник: http://paruvella.spaces.live.com/Blo...4DB0!549.entry
==============


Further journeying from my previous article
http://paruvella.spaces.live.com/blog/cns!F2EC589E221A4DB0!546.entry
In my previous article we have explored how we can read the XML string and field values.

In this article we will explore, how we can store those field values in to the table.

Assume that we have table,


Now generate Ax-BC class for the above table, if we already have Ax-BC for the same no issues, otherwise create the same from

AOT à Classes à AxGenerateAxBCClass

Run the above class by selecting our above table.

Make sure that class is free from compile errors.

After the Ax-BC class is created and made that compile free. Use the following job.

static void PSReadXMLFileAsStringAttr(Args _args)
{

    XmlTextReader       xmlTextReader ;
    str                 xmlString = 'http://www.w3.org/2001/XMLSchema-instance">'
                                    +''
                                    +'o130006'
                                    +'260005'
                                    +''
                                    +'';

    str                 fieldName;
    SysDictClass        sysDictClass;
    str                 parmMethodName;
    AxATGAXSTGCustTable axCustTable;

    ;

    xmlTextReader = XmlTextReader::newXml(xmlString, true) ;


    while(xmlTextReader.read())
    {
        switch (xmlTextReader.NodeType())
        {
                case XmlNodeType::Element: // The node is an element.
                    fieldName = xmlTextReader.Name();
                    switch (fieldName)
                    {
                        case "ATGAXSTGCustTable":
                            sysDictClass = new SysDictClass(classnum(AxATGAXSTGCustTable));
                            axCustTable = sysDictClass.makeObject();
                            break;
                    }
                    break;
               
                case XmlNodeType::Text: //Display the text in each element.
                    parmMethodName = "parm" + fieldName;
                    sysDictClass.callObject(parmMethodName, axCustTable, xmlTextReader.Value());
                    break;
               
                case XmlNodeType::EndElement: //Display the end of the element.
                   
                    switch (xmlTextReader.Name())
                    {
                        case "ATGAXSTGCustTable":
                            sysDictClass.callObject("doSave", axCustTable);
                            break;
                    }
                    break;
        }
    }
     pause;

}

Run the above job and see the result in table from the table browser.


....



Источник: http://paruvella.spaces.live.com/Blo...4DB0!549.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
paruvella: De-serialization of string format XML in Dynamics Ax Blog bot DAX Blogs 0 21.07.2010 22:06
CRM DE LA CREME! Some more useful javascripts for MS CRM Blog bot Dynamics CRM: Blogs 0 04.05.2010 11:05
paruvella: Generation of XML file from DAX, without using AIF Blog bot DAX Blogs 0 23.04.2010 12:05
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05
Axapta Lessons: Export a table to a file Blog bot DAX Blogs 0 28.10.2006 18:22

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

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

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