Hi Paul,
Here is an example 'Job' of how you can populate the XMLDocument class with XML nodes and values in those nodes. You can create a 'Job' in the AOT and test building out your xml and saving it to a file. Once you have that working you can copy this code into your closeOk() method if you would like. You are going to want to write code like this:
"
while select myDataSource
{
//put code here to populate the oDoc object. See the other links for examples on how to do this.
}
odoc .save('C:\\Temp\\MyXMLFile.xml');
"
static void testXml(Args _args)
{
XMLDocument odoc = new XMLDocument();
XMLNODE oNode;
str test;
str result;
XMLTextWriter writer;
writer = XMLTextWriter::newXml();
test = 'Test';
writer.writeElementString('Something',test);
writer.close();
odoc.loadXml(writer.writeToString());
onode = odoc.selectSingleNode('Something');
if(onode)
{
info(strfmt('%1',onode.text()));
}
odoc .save('C:\\Temp\\MyXMLFile.xml');
}
Here are some additional helpful links:
http://axzaptech.wordpress.com/2010/11/24/create-xml-and-write-to-file-in-dynamics-ax/
http://learnax.blogspot.com/2010/01/x-code-to-write-data-to-xml-file.html
https://shyamkannadasan.blogspot.com/2016/06/ax-creates-xml-file-in-x-containing.html
------------------------------
Peter Ramer
Manager
RSM
Greenwood Village CO
------------------------------
Original Message:
Sent: Nov 20, 2020 05:17 AM
From: Paul Fildes
Subject: Creating a custom form/dialog in AX 2012
Hi Wes,
Thanks for your message and the suggested links. I have so far, created a Popup form, containing a grid which is populated by a View. I also have a StringEdit field associated to the "FilenameSave" EDT which allows me to prompt for an XML file.
I'm now looking at processing the selected grid lines to save the data to the XML file in the form's closeok() method
Thanks again
Paul
------------------------------
Paul Fildes
AX Technical Support Consultant
Steelite International Ltd
Stoke-On-Trent
Original Message:
Sent: Nov 19, 2020 10:25 AM
From: Wes Burke
Subject: Creating a custom form/dialog in AX 2012
Hi Paul,
Here's a link that will help you out with the code needed to generate the XML file:
https://shyamkannadasan.blogspot.com/2016/06/ax-creates-xml-file-in-x-containing.html
Here is one that will help you with creating your dialog box:
https://docs.microsoft.com/en-us/dynamicsax-2012/developer/using-classes-to-create-a-dialog"">https://docs.microsoft.com/en-us/dynamicsax-2012/developer/using-classes-to-create-a-dialog""="">https://docs.microsoft.com/en-us/dynamicsax-2012/developer/using-classes-to-create-a-dialog" target="_blank" rel="noopener"> https://docs.microsoft.com/en-us/dynamicsax-2012/developer/using-classes-to-create-a-dialog
Good luck!
Wes
------------------------------
Wes Burke
Senior Business Intelligence Analyst
Miltope Corporation
Hope Hull AL
Original Message:
Sent: Nov 18, 2020 06:30 AM
From: Paul Fildes
Subject: Creating a custom form/dialog in AX 2012
Hi all,
I'm looking to create a custom form/dialog which would prompt the user for a list of shipped shipments and a XML filename. I am new to Form development and would appreciate some advice on how I should proceed.
I envisage the form to include a non-editable grid, a textbox and a button to allow file browsing. When a user selects a collection of shipments from the grid and specifies a filename in a simple textbox and clicks on a OK button, the form should create an XML file containing field values from the shipment.
I've reviewed the "tutorial" sample forms in the AOT and cant quite find one suitable to start from. Can anyone advise how I go about this or recommend any good training material that I can use to help me?
Thanks and regards,
Paul
#AX2012 #Intermediate #Technical
------------------------------
Paul Fildes
AX Technical Support Consultant
Steelite International Ltd
Stoke-On-Trent
------------------------------