Creating a report in X++ code and running

Here is a small job that demonstrates the main parts of build a report dynamically in X++ and launching it.   static void MakeReportJob(Args _args) {     #AOT     str reportName = ‘aaMakeReport’;     tableid custTableId = tablenum(CustTable);     TreeNode reportNode = TreeNode::findNode(#ReportsPath);     Report areport;     ReportDesign design;     ReportAutoDesignSpecs specs;     ReportSection section;…


X++ Server Threads

You can create threads in X++ to perform tasks in the background.  Here is a vey simple class that demonstrates the basics.   class ThreadDemo {     static server void main()     {         Thread t;         ;         new ExecutePermission().assert();         //BP Deviation Documented         t = new Thread();         t.run(classnum(ThreadDemo), staticmethodstr(ThreadDemo, run));    …

3

Enable Debug on Server

When single stepping through X++ code on the client you can bump into code that can only execute on the server.  In a default deployment you will not be able to single step through the code.  To enable this feature you must turn it on in the ‘Microsoft Dynamics AX Server Configuration Utility’ tool.  …


Command Line To Import Data

In Axapta 4.0 you can use the -startupcmd=autorun_ command line option to batch import data is two steps.   1. Create an xml file (demoData.xml for example) that looks like this: <?xml version=”1.0″ encoding=”utf-8″ ?> <AxaptaAutoRun exitWhenDone=”true” version=”4.0″ logFile=”axautodata.log”>        <CompanyAccounts >               <Company name=”Demo Company” id=”DMO” overwrite=”true” />        </CompanyAccounts>        <DataImport companyId=”DMO” file=”demoData.dat”…

1

Using dimof() on a Dynamic Array

I stumbled across some older X++ code that was using the little know dynamic array.  It took a while to find out how to retreive the size of the dynamic array.  Here is a little example of using a dynamic array in Axapta:   int foo[]; int r; ; foo[10] = 1; r = dimof(foo); …


What are Menu item references on report control?

Menu item references are used to add alternative drill down links in a report.  When you right click on the output field in the report the list of menu items will be presented in a popup menu.  The easiest way to add menu items to a report is to drag-n-drop them from the menu item…