Archive for the ‘Dynamics AX 4.0’ Category

How to add a timer to the SalesTable form

Wednesday, December 12th, 2007

When you want a grid in a form to be updated on a regular basis (so your users always see latest information), you need to add a timer to your form. You need two things. A timer method and a initial call to it when the form starts.
(more…)

SysInfoAction

Tuesday, December 11th, 2007

Found this blog entry made by Kamal. The entry explains how to use the SysInfoAction classes. I played around with this classes and found out that you can get pretty specific when referring the user to the source of the info message.

This is a simple job that produces an info box that gives the user the option to open a form and edit a specific field on a specific record:
(more…)

Copy data between companies

Friday, November 30th, 2007

I have recently done some modifications that required certain data that was very time demanding to enter manually in Dynamics Ax. This data was also needed in a number of different companies which meant that I had to enter this data several times.

Because I’m against all that is time consuming I created a script that only require that I enter my data once and then lets me copy this data to the other companies.
(more…)

Using CacheAddMethod

Tuesday, November 27th, 2007

When working in forms and using display methods, sometimes they have a tendency to slow down the form to the degree that makes you wonder if it’s worth it at all. This is when cacheAddMethod comes in handy.

When using cacheAddMethod we place the method in memory, the effect of this is that the method only runs once when the form loads and then every time we switch between records. This instead of display methods normal behavior, which means it runs every time all the time.

For the cacheAddMethod to do what it’s supposed to we need it to run when the form starts up. If we have created the display method “OurTestMethod” on table SalesTable we want to place the call to cacheAddMethod in the init method on the form datasource SalesTable.
(more…)

How to read the Data Dictionary in Axapta

Thursday, November 22nd, 2007

This little script creates an Excel .CSV (text) file of complete Data
Dictionary of current Axapta environment. Handy when you need
to have a collected list of all tables and there fields with types etc.
(more…)

Class InventOnhand

Monday, November 19th, 2007

The class inventOnhand is very useful when retrieving inventory information for a specific item.

If we want to get the sum of an item for all warehouses and all configurations:
(more…)

How to traverse a directory in Axapta

Friday, November 16th, 2007

This example list all files in a directory including sub-directories. Handy when you need to do something with a number of files stored in a structure of folders. Here we lists all the text files it can find, you only need to alter the FO_ProcessFile() method for your needs.
(more…)

resAppl macro when using images

Monday, November 12th, 2007

Using images in Dynamics AX can sometimes be a painful experience, just keeping track of the Integer that represents the images is almost impossible. But with a macro called resAppl this becomes much easier, mainly because you, most of the time, can guess what commands to use to get the image you want. This makes it easier to remember between times you are going to use it, and above all it makes your code much easier to read and follow.
(more…)

Find files in a file directory

Thursday, November 8th, 2007

If you want to open or read files in a file directory you can use the following example to find the filenames.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  static void showFileName(Args _args)
  {
      int           handle;
      FilePath      filePath;
      FileName      FileName;
      ;
 
      filepath = "c:\\windows";
 
      [handle,filename] = 
       WinAPI::findFirstFile(filepath + "\\*.*");
 
      while (filename != "")
      {
          info(filepath + "\\" + filename);
          filename = WinAPI::findNextFile(handle);
      }
 
      WinAPI::findClose(handle);
  }

Browse the data dictionary with X++

Thursday, November 8th, 2007

Browsing the Data dictionary through X++ code is easier than you may think. Let’s say you want to list all of the fields in table InventTable.

This is one way to do it:
(more…)