This is an easy way to use labels and infologs in a bit more dynamic manner. It also makes it easier to do type conversion of for example dates to strings when printing to infologs.
static void FO_StrFmt(Args _args)
CustTable cust = CustTable::find("4000");
SalesTable sales = SalesTable::find("00697_036");
info(strFmt("Hello %1!", cust.Name));
info(strFmt("Hello %1, you live in %2!",
Hello Light and Design!
Hello Light and Design, you live in Los Angeles!
Notice that the date is presented in the format that is set up on the clients computer. In this case the Swedish format. The same format that you see in the Sales Table form.
In Dynamics AX it is possible to select multiple records in any form, well at least you can if more than one record is visible. This example describes a simple way to handle the selected records before doing something with or to them. In this example we have a clicked-method on a button. If, and only if, the new field “newField” on our table “TestTable” is set on all the selected records, then the super() is run.
Continue reading Multiple records selected in a form
The editor in Axapta is as easy to extend as the rest environment. If you check the class EditorScripts, you see a list of methods which is standard. In this example we add a little script which marks your inputed extra code. We always mark all added or changed code, to make it easier to see afterwards what’s added and what’s standard. By doing this it is also makes it very easy to search for all code related to a certain project. This code is an example of what we all use several times a day.
Continue reading How to extend your editor in Axapta
If you want to open or read files in a file directory you can use the following example to find the filenames.
static void showFileName(Args _args)
filepath = "c:\\windows";
WinAPI::findFirstFile(filepath + "\\*.*");
while (filename != "")
info(filepath + "\\" + filename);
filename = WinAPI::findNextFile(handle);