Save As Dialog in AX
Method to Open Save As dialog
public str saveFile(str Empl_Details_List)
{
Dialog dialogSaveAs = new Dialog("File Save As");
DialogField dialogFileName;
str fileName;
dialogFileName = dialogSaveAs.addField(extendedTypeStr(FilenameSave), "File Location:","");
dialogSaveAs.filenameLookupFilter(['xml','*.xml']);
dialogSaveAs.filenameLookupFileName(Empl_Details_List);
if (dialogSaveAs.run())
{
fileName = dialogFileName.value();
if (fileName == '') throw error("Select File Save As Location");
}
return fileName;
}
Method for XML Document Generation
static void ShyamXMLWriteEmplAddr(Args _args)
{
FileIoPermission permission;
XMLDocument xmlDoc = XMLDocument::newBlank();
XMLNode rootNode;
XMLNode NodeEmpl, NodeName, NodeAddr;
XMLElement xmlElement;
XMLText xmlText;
HCMWorker HCMWorker;
str fileName;
;
permission= new
FileIoPermission('"C:\\Users\\shyamsundar.kanna\\Documents\\Testing\\Empl_Details_List.xml','w');
permission.assert();
xmlDoc = XMLDocument::newBlank();
// Create first line containing version info
rootNode = xmlDoc.documentElement();
xmlElement = xmlDoc.createElement('EmployeeList');
rootNode = xmlDoc.appendChild(xmlElement);
while select HCMWorker
{
// Create a node for the Employee record
xmlElement = xmlDoc.createElement('Employee');
NodeEmpl = rootNode.appendChild(xmlElement);
// Create a node for the name
xmlElement = xmlDoc.createElement('EmplName');
NodeName = NodeEmpl.appendChild(xmlElement);
xmlText =xmlDoc.createTextNode(HCMWorker.Name());
NodeName.appendChild(xmlText);
// Create a node for the address
xmlElement = xmlDoc.createElement('EmplEmail');
NodeAddr = NodeEmpl.appendChild(xmlElement);
xmlText =xmlDoc.createTextNode(HCMWorker.email());
NodeAddr.appendChild(xmlText);
}
//Open Save Dialog
Method to Open Save As dialog
public str saveFile(str Empl_Details_List)
{
Dialog dialogSaveAs = new Dialog("File Save As");
DialogField dialogFileName;
str fileName;
dialogFileName = dialogSaveAs.addField(extendedTypeStr(FilenameSave), "File Location:","");
dialogSaveAs.filenameLookupFilter(['xml','*.xml']);
dialogSaveAs.filenameLookupFileName(Empl_Details_List);
if (dialogSaveAs.run())
{
fileName = dialogFileName.value();
if (fileName == '') throw error("Select File Save As Location");
}
return fileName;
}
Method for XML Document Generation
static void ShyamXMLWriteEmplAddr(Args _args)
{
FileIoPermission permission;
XMLDocument xmlDoc = XMLDocument::newBlank();
XMLNode rootNode;
XMLNode NodeEmpl, NodeName, NodeAddr;
XMLElement xmlElement;
XMLText xmlText;
HCMWorker HCMWorker;
str fileName;
;
permission= new
FileIoPermission('"C:\\Users\\shyamsundar.kanna\\Documents\\Testing\\Empl_Details_List.xml','w');
permission.assert();
xmlDoc = XMLDocument::newBlank();
// Create first line containing version info
rootNode = xmlDoc.documentElement();
xmlElement = xmlDoc.createElement('EmployeeList');
rootNode = xmlDoc.appendChild(xmlElement);
while select HCMWorker
{
// Create a node for the Employee record
xmlElement = xmlDoc.createElement('Employee');
NodeEmpl = rootNode.appendChild(xmlElement);
// Create a node for the name
xmlElement = xmlDoc.createElement('EmplName');
NodeName = NodeEmpl.appendChild(xmlElement);
xmlText =xmlDoc.createTextNode(HCMWorker.Name());
NodeName.appendChild(xmlText);
// Create a node for the address
xmlElement = xmlDoc.createElement('EmplEmail');
NodeAddr = NodeEmpl.appendChild(xmlElement);
xmlText =xmlDoc.createTextNode(HCMWorker.email());
NodeAddr.appendChild(xmlText);
}
//Open Save Dialog
fileName= this.saveFile(Empl_Details_List);
// Save the file
xmldoc.save(fileName);
//Show File Location
Box::info(fileName);
//Open Saved File
Infolog.urlLookup(fileName);
}
}
monstratQdiuzo Nasser Vazquez https://wakelet.com/wake/01CxyEZoEBZV4-DCY0YvH
ReplyDeletealniskoran
eclanden-i Vida Terrell VMware Player
ReplyDeleteVysor
CorelDRAW
lodardestfib