Thursday, February 15, 2007

AxCopyTableFieldListToClipboard - another IDE extension tool for Microsoft Dynamics AX 3.0

Hello, readers.

Here is another tool for Dynamics AX developers.
Homepage

All it does is populates the Windows Clipboard with the lines that you can paste into your code, so you won't have to retype the same code many times.

Download the tool here

Features (You can ... ):
  1. Insert a variable declaration before using the name; You will have to move the declaration where it belongs if pasting in the middle of a method.
  2. Insert a call to clear() method of a table variable in order to clear its contents. This is useful, for example, when doing inserts in a loop.
  3. Specify a different variable name than the one by default (tableName). If the variable is unacceptable, the image on the right will point out the mistake.
  4. Choose which fields to copy into the clipboard. There are 2 presets so far. The list will be extended in future releases.
  5. Insert a call to insert() or update() after the lines with field values assignment.

The tool can be integrated into the system in a couple of ways:

  • Insert the menuItem AxCopyTableFieldListToClipboard into the SysContextMenu menu. The text "Copy Table FieldList" will be automatically added to the context menu on AOT objects. In order to sort this out and show the text only for tables, you have to modify the method verifyItem of the SysContextMenu class. Paste the following code into the appropriate section (after case MenuItemType::Action:)
    //--> AxCopyTableFieldListToClipboard_ikash date=2007-02-11 txt='Show in menu only for tables'
case menuItemActionStr(AxCopyTableFieldListToClipboard):
if (this.selectionCount() != 1 firstNode.AOTIsOld())
return 0;

if (!docNode && firstNode.sysNodeType() == 204)
return 1;

return 0;
//<-- AxCopyTableFieldListToClipboard_ikash
  • Insert the menu Item into the GlobalToolsMenu or the DevelopmentTools menu. Then select a table in the AOT and run the menu.
  • You can add the bmp image attached to the project into the plugs folder of Tabax and you will automatically be able to launch the tool from the Tabax toolbar.
  • You can select a table name in the editor and call the tool from the editor scripts. In order to insert the tool into the editor scripts create a method with the following code in the EditorScripts class.

void AOT_Copy_TableFieldList(Editor e)
{
Args args = new Args();
;

args.parmObject(e);

new MenuFunction(menuItemActionStr(AxCopyTableFieldListToClipboard), MenuItemType::Action).run(args);
}


Also (especially DAX 4.0 users), take a look at the link to Casper Kamal's post. He describes similar functionality already included in the 4.0 release.
Hey, great to know MS developers and I are thinking the same thoughts ;)
Anyway, here is the link:
http://casperkamal.spaces.live.com/Blog/cns!9138ED475277CD63!221.entry

Thanks to:

  • aidsua - for a hint on the match function
  • AndyD - ListView setColumnWidth help and WinApi stuff