Dynamics AX Development training consists of six courses from an introduction to AOT objects and X++ code, to developing Windows apps that connect to Dynamics AX.
I completed Development I and II in my first two weeks as an AX developer and found it incredibly overwhelming. (It might also have something to do with the fact that it was presented in Dutch, and I am not Dutch… but who knows?)
I was fortunate to be sent on the Dynamics AX Developer III training this week. Dev III consists out of four days spread over two weeks. I’ve completed day one today and it has been great! I have learned a lot (but not so much as to feel completely overwhelmed) and this time I even understand and speak Dutch.
Here are a few unrelated points I jotted down in class today. They are not necessary related to the topics in the official material but are nevertheless things I would like to remember:
Dynamics AX development wizards
Dynamics AX had a few wizards that can be used to create objects in the AOT. The wizards are found under Tools > Wizards.
For example, the class wizard can be super useful, since it can create a child class with all the abstract methods in the parent.
It is possible to start the AX client via command line and specify a startup command line parameter like synchronize, checkbestpractices and compileall.
For example, if you have a Unit Test project (Unit tests are chapter 1 in Dev III), you can start the client with the command prompt and your project name. In this case you must also add a XML listener to the Unit Test Parameters. This will run your tests in the client and write the results to a XML file.
Also… did you know you can write your own start up commands?! Startup commands are handled by a standard AX class named SysStartupCmd. In the construct method, you can see all the available start up commands in a switch() statement, and you can customize it to add your own client startup commands.
I got entirely caught up in the idea that when tables extend other tables, they inherit fields from the parent table. It never occurred to me that table inheritance also applies to the table methods. In other words, a child table inherits all the methods from the table it extends from.
- EcoResProductMaster table extends EcoResProduct.
- EcoResProduct contains a method displayProductName().
- Since EcoResProductMaster is a child of EcoResProduct, displayProductName() can also be called on an instance of EcoResProductMaster.
static void childTableEcoResProductMaster(Args _args)
//EcoResProductMaster does not contain the method displayProductName, but it parent table does
productName = productMaster.displayProductName();
[UPDATE: This is also true for methods like insert(), but not for find(), since find() is a static method. ]
The select statement is slower than a query
Retrieving data with a query is faster and more reliable that an X++ select statement. This surprised me because I thought it was the exact opposite.
The trainer said that AOT or X++ queries execute faster because they run a server side action and the data is never copied to the client. With a select statement the data makes several round trips to the database before the result of the select is available in the client.
Queries are supposedly also much easier to maintain than complex select statements.
[UPDATE: Test this yourself! To know if the query or select statement is faster use WinAPI::GetTickCount() before and after you retrieve the data. Get the difference in time at the start and end a few times and compare.]
..and other trivia:
- CrossCompany select retrieves readonly data. To modify data across companies, use the changCompany() statement.
- It is possible to retrieve data backwards with while select reverse
- Tables contain a property called Table group, which provide a method for categorizing tables according to the type of data they contain.
- Use query.prompt() on an AOT or X++ query to open a dialog and allow the user to modify the query.
I’ll be back with an update on day 2 tomorrow!
If you find any of the above topics interesting, confusing or incorrect, let me know in the comments and I will try to elaborate on them in a future post.