![]() |
#1 |
Участник
|
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, напишите личное сообщение администратору. |
|
|
|