Home > Ax Technical > Creating a custom compiler output type and displaying in the compiler output in Dynamics Ax 2009

Creating a custom compiler output type and displaying in the compiler output in Dynamics Ax 2009

This article will guide in creating a custom compiler output Type like “To Do” , “Error” and “Best Practices” in Dynamics Ax 2009.

0. First change your compiler to “Message window” until you complete this. Retaining it as “Form” might result in runtime errors which cannot be resolved. This is because it will stop your compiler from executing and consequently any further progress.

1. Add a element to the enum “SysCompilerOutput”. Let’s call it “Custom”

2. Add a new datasource to the Form “SysCompilerOutput” for the table “TmpCompilerOutput”. Name it “Custom”. Also create a tab, grid and drag fields to it.

3. Now override the “init” method of the datasource and write the following code.

public void init()
    QueryBuildRange range;

    range = this.query().dataSourceNo(1).addRange(fieldnum(TmpCompilerOutput, SysCompilerOutputTab));

4. Go to class “\Classes\SysCompilerOutput” and create a global variable “Custom_Ds” and create a parm method for this datasource like “\Classes\SysCompilerOutput\parmBestPractices_ds

5. Go to “\Classes\SysCompilerOutput\updateDataSources ” and add the following lines

        this.updateCursor(custom_ds, tmpCompilerOutput);

6. Now change your compiler output to “Form”

7. Run the following Job to test it.

static void JobTestCompiler(Args _args)
    SysCompileroutput     output;

    output = infolog.compilerOutput();

    output.compilerOutputMessage('Custom Message 1', 66, 1, 2, 3, 'Just a try', 'Method name', SysCompilerOutputTab::Custom);
    output.compilerOutputMessage('Custom Message 2', 85, 1, 2, 3, 'Second Try', 'Property name', SysCompilerOutputTab::Custom);

8. Now you can make the above call from any place in the application to add contents to the compiler output tab.

**Just a note, This is only to start with it. You may want to setup your own custom error messages, error codes, images. You have to explore forward from here to accomplish those.**

  1. July 16, 2012 at 1:36 pm

    Hi Jonathan, we had also built a option to export the files to a local file. The trick is you have to get the instance of the tmpCompilerOutput(refer \Classes\SysCompilerOutput\exportLog) and then you can play around. If you refer the class path mentioned above you can see how standard does the import. But that generates huge amount of data as it includes all filed from the table. So what we had done was to modify the table.xml() method to return just the fields that we required.

    In your case however i may suggest you to do the following, 1. Have you checked the Tools options to reset your output to SysCompilerOutput 2. Delete the changes if you had made any on the classes 3. Clear your .aoi file in case you are working in ax2009. If nothing works let me know i’ll try to suggest a few more options.

    • July 17, 2012 at 5:11 pm

      Thank-you so much for your help above. After deleting the AOI as suggested everything seemed to revert back to normal.

      • July 17, 2012 at 5:51 pm

        good to know 🙂

  2. July 16, 2012 at 12:42 pm

    Hi. I’m not sure if you can assist me. I have been trying to create job that can output the results of a compile to a static file automatically. But in the process have broken my normal compiler. I no longer get any output from the compiler via either the MessageWin or the CompilerDialog. Is there any way to restore the original SysCompilerOutput object (or create a new one) if I forgot to maintain a reference to it.

  1. May 5, 2011 at 7:39 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: