Thursday, March 25, 2010

How to create a GUID in Ax

In my previous post I talked about the Ax cache file and how it's name is created by using a GUID. Actually GUIDs are used in several places in Ax, like AIF for example.

You can create your own GUID with Ax as well, if you have a need for one. The WinAPI class has a method for that.

Example:

static void CreateGUID(Args _args)
{ str myGUID;
;
myGUID=Winapi::createGUID();

info(myGUID);
}

This method depends on the kernel function newguid() to create a globally unique identifier.

Note that you can have the GUID with or without the { }.

1 comment:

  1. Yes you can use this function when you use it for making xml etc. When you have a table and have a guid field there, then it is advisable to use newguid() directly....

    ReplyDelete