Working with numbersequences – new NumberSequence

September 22, 2017 No comment

A few years a go I made a few posts about numbersequences, in these posts I forgot to mention that you need to execute the following job before you can find your new created Numbersequence.

static void NumberSeqLoadAll(Args _args)
{
    NumberSeqApplicationModule::loadAll();
}

Maximize a form in Ax

September 15, 2017 No comment

Change the properties width = ‘column width’ and height = ‘column height’ on the form.

Add the following code in the run-method of the form:

#WinApi ; 
super(); 
WinApi::showWindow(this.hWnd(), #SW_SHOWMAXIMIZED);

Change the language at runtime

November 30, 2011 No comment

Normally when you change your language you go to your user options, change your current language and the restart the client. This week I got the question if it was possible to do so in runtime. You can do so by just calling the infolog.language(str 7 _languageCode). All labels that you load after calling this method will be translated to the new language. (more…)

Amount in words

November 28, 2011 No comment

This week one of my customers asked me to place the amount in words on a invoice. I couldn’t believe that sush function wasn’t availible in standard Ax. After some research I found that the Global-class contains the following methods:

(more…)

Index vs Index hint

October 1, 2010 4 comments

This is a discussion I had with several colleagues. What is the difference between index and index hint and what do we use in our code?

(more…)

Testing code on client/server

September 25, 2010 No comment

When you quickly want to test some code I often write some test-code in a small job. When you execute the code in this job, it will be executed on client-side. A colleague of mine asked me if he could test the same job while running on server-side.

Wen you quickly want to test the same code when it is running on server side, you can simply create a action-menu item from this job and change the property ‘RunOn‘ property to ‘Server‘. Now when you execute the menu item, the job will be executed on server.

Loop all tables

September 16, 2010 1 comment

There is a simple trick to loop all tables that are available in Ax. Just use the Dictionary-class that contains all information about tables.

Small example to list all tablenames + their corresponding Id.

1
2
3
4
5
6
7
8
9
10
static void JeDoe_listTables(Args _args)
{
    Dictionary  dictionary = new Dictionary();
    int         i;
    ;
    for (i=1 ; i<=dictionary.tableCnt() ; i++)
    {
        info(strfmt('%1;%2', dictionary.tableCnt2Id(i), tableid2name( dictionary.tableCnt2Id(i) )));
    }
}

When you combine this with a DictTable / DictField-object, there are lots of possibilities.

Records with RecId 101090

August 4, 2010 2 comments

I was using the postload method of the HRMBenefitType-table to fill the description-field with language-sensitive description (from LanguageTxt). This works fine when I view the record, but not when I use a lookup.

I’ve put a break-point on my postload method and noticed the recId (this.recid of the HRMBenefitType table). This is always the 101090. When I check this in the tablebrowser, this does not match the actual RecId valule.
I checked the SQL-trace-log and noticed the following instruction:

SELECT A.HRMBENEFITTYPEID,A.DESCRIPTION,A.RECVERSION,101090 FROM HRMBENEFITTYPE A WHERE (DATAAREAID=?) ORDER BY A.DATAAREAID,A.HRMBENEFITTYPEID OPTION(FAST 1)

The solution to this problem is simple. Just change the CacheLookup property to EntireTable and the strange behaviour of the RecId-field stops.

Dialog Extended

May 12, 2010 No comment

One of my colleagues (Koen Dedecker) was looking for a way to prevent user interaction with other forms while a certain dialog is shown. After some research he found the solution on the blog Dynamics AX tools and tutorials from Vanya Kashperuk. A few years ago (2007) he made a simple extension of the dialog class that makes this possible. You can find more information and download some code samples on http://kashperuk.blogspot.com/2007/06/3-dialog-extensions.html.

The trick is actually simple:

Now when you make a new instance of the dialog class just set the value of the parmShowModal() to true. From now on this dialog will stay on top.

A few things you should know about temporary tables

May 10, 2010 2 comments

How do you set a table temporary:
  • You can set the property ‘temporary’ in the AOT to yes –> this table is always temporary
  • You can declare a buffer of a table and call the method setTemp() or setTempData(), from that moment on the buffer contains temporary data.
    CustTable custTable;
    ;
    custTable.setTmp();
    if (custTable.isTmp())
    {
        // Do something with your temporary table
    }
Things to know:

My opinion: Temporary tables are very useful and can help you to easily manipulate data you don’t need store permanently, but watch out where and how you use them.

Next Page »