This is to show a method to execute external database stored procedures from X++ code. Create a job in AOT with following code. Follow the steps as explained here in the code like replace Server Name, Database name , Stored Procedure name.
The below code is executed through the ODBC Connection.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 static void execExternalDatabase(Args _args) { LoginProperty loginProperty; ODBCConnection odbcConnection; Statement statement; ResultSet resultSet; ResultSetMetaData resultSetMetaData; Counter counter; str sql; SqlStatementExecutePermission perm; ; loginProperty = new LoginProperty(); loginProperty.
Login to the AX AOS server and follow below steps.
Click Start > Administrative Tools.
Right-click the Microsoft Dynamics AX 2012 Management Shell option.
Click Run as administrator.
Go to PowerShell command prompt and run with command
Publish-AXReport –ReportName *
Wait up to getting Deployment successful message in command prompt.
To execute a stored procedure from X++ use the Server method, the Client method does not have permissions; you don’t require any special privileges or permissions to execute a stored procedure. If we use other than Server method, a message should appear like this
Warning Request for the permission of type SqlStatementExecutePermission failed. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 public static void main(AssemblyLoadEventArgs _args) { Connection con = new Connection(); Statement stmt = new Con.
Hi there,
Infographic
Ref Report from http://www.artofcreation.be/ Tip 1: Measure execution time of your code Measuring is knowing. Before you start changing code, make sure you have a set of data you can keep reusing for your tests. Measure the performance of your code on that data after each change in code so you know the impact of your changes.
One way to do this is by using the Winapi::getTickCount() or WinApiServer::getTickCount() if your code runs on server method.
In this post let’s explore creating XML using X++ code in Dynamics AX.
The following example shows how to create and write data to an XML file by using the XmlDocument, XmlElement, and XmlWriter classes. It loops through all of the records in the CarTable and find all the fields in the table automatically by using the DictTable and DictField classes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 static void WriteXml(Args _args) { XmlDocument xmlDoc; XmlElement xmlRoot; XmlElement xmlField; XmlElement xmlRecord; XMLWriter xmlWriter; CarTable carTable; DictTable dTable = new DictTable(tablenum(CarTable)); DictField dField; int i, fieldId; str value; ; #CarsXmlTags // Create a new object of the XmlDocument class xmlDoc = XmlDocument::newBlank(); // Create the root node xmlRoot = xmlDoc.
The answer is that there is no difference, the difference is a conceptual one rather than a functional or a technical one. So I think you will make a better choice for your scenario base on functional side.
hello Display Menu item This folder is used to contain menu items that reference runnable application objects that primarily present forms, ddialog and so on, to the user. May be this forms, dialog called from another forms.
The model store is the portion of the Microsoft Dynamics AX database where all Microsoft Dynamics AX application elements are stored, including customization. The model store replaces the AOD (application object definition) files used in previous releases of Microsoft Dynamics AX (I mean from 4.0 to 2009).
Layer and model information are integral parts of the store. The AOS has access to the model store, handles layer-flattening, and provides model data to all the Microsoft Dynamics AX sub-systems, such as form- and report-rendering and X++ code.