Saturday, June 1, 2013

How many tables are there in AX 2012?





Sometimes people want to know how many tables exist in an AX environment. Since different environments can vary in regards to the number of tables there can be due to customizations and 3rd party software, I wrote a job you can copy and paste in a job and run. It should only take a second or two to run. Kinda fun. The environment I wrote this in had 5534.

In the code, you can modify the '\\' string to do something like count forms '\\Forms' or EDTs '\\Data Dictionary\\Extended Data Types'

I'm aware of the #TablesPath (in #AOT) being used instead of the '\\Data Dictionary\\Tables' string but I wanted to keep this example simple and straight forward.

static void daxCountTablesInAX(Args _args)
{    
    // Count of all the forms.    
    info (strFmt("Tables in AX: %1", treenode::findNode('\\Data Dictionary\\Tables').AOTchildNodeCount()));    
}

Figure 1 - The infolog from the code above


2 comments:

  1. There is easier way :) AX shows count of elements for every node in AOT automatically in status bar. For nodes with lot of elements: expand node, go to the first element, wait for while (AX is counting) and go back to the node. Result should be like this: http://img194.imageshack.us/img194/5041/ax2012.png

    ReplyDelete
  2. Daniel, Nice shortcut! I never noticed that before. Thanks for the share!

    ReplyDelete