Greg On Dynamics Ax

Random thoughts about development using Dynamics AX and .Net

Posts Tagged ‘Axapta

Discover hidden AX resources

with one comment

A very popular AX community is AXForum.info, the only problem for English speakers is that the main language is Russian*

This site also publishes an RSS feed for each of its newsgroup, which is great for keeping up to date without having to visit the site.

Click here for the link to the feed in English  (Courtesy of Yahoo Pipes)

This RSS feed (linked to above) was created (by me) using Yahoo Pipes. Yahoo pipes lets you ‘pipe’  information from different data sources and set up rules for processing  that content, if you have a Unix background think of them as Unix pipes.

Using the pipes creator (Which has a great looking GUI!), the axforum.info programming newsgroup was provided as a feed data source, then loop operators were used to translate the title and description of the feed and  then another operator used to modify the link (so that when you click on the title the source page with full thread is also translated)

Here is the yahoo pipe, where you can view the source:

Yahoo Pipe for AXForum.info

Yahoo Pipe for AXForum.info

AXforum.info has been mentioned in these other blog posts:

* With the exception of the sub-forums in different languages, but these are not as busy.

Written by gregondax

February 23, 2009 at 1:35 pm

One thing you should know about the x++ Type ‘anytype’

with one comment

I came across this little gem the other day.

If you declare a variable of type ‘anytype’, assign its value to an enumerated type, then try and reassign it to a date, the code will compile but you will get an error at runtime.

Here is an example

static void AnytypeAssignmentError(Args _args)
{
    anytype enumOrDate;
    ;
    enumOrDate = NoYes::Yes;
    enumOrDate = 06\2\2009; // this should be the date 6th Feb 2009 in x++
}

And here is the error when you run it:
assignmenterror

So it works in a very similar way to the C# 3.0 type ‘var’, with the exception that you will not get a compile error in x++.

The documentation explains anytype should not be used in this way:

If anytype is used as a variable, you must assign a value to it before it can be used or you will get a run-time error. After you have assigned a value to it, you cannot convert it to another data type.

See here for more detail MSDN anytype reference page

Written by gregondax

February 6, 2009 at 1:41 pm

Handy editor script

leave a comment »

Editor scripts can come in really handy for repetitive tasks.

Being quite a stickler for code that is nice to read, I have written an extension that makes it easy to format blocks of variable assignment or declarations into nicely formatted columns.

Take the following code, for example:

static void Example(Args _args)
{
    IntrastatParameters intrastatParameters = IntrastatParameters::find();
    SalesTable salesTable;
    NumberSeq numberSeq;
    SalesLine salesLine;
    SalesFormLetter salesFormLetter;
    ;
    numberSeq = NumberSeq::newGetNumFromCode(SalesParameters::numRefSalesId().NumberSequence);

    salesTable.SalesId = numberSeq.num();
    salesTable.TransactionCode = intrastatParameters.DefaultSalePurchase;
    salesTable.Transport = intrastatParameters.TransportModeParm;
    salesTable.Port = intrastatParameters.PortParm;
    salesTable.CustAccount = "4015";

By selecting the blocks of declarations, then choosing Scripts -> addIns -> FormatToColumnLayout, will result in the following:

static void Example(Args _args)
{
    IntrastatParameters intrastatParameters = IntrastatParameters::find();
    SalesTable          salesTable;
    NumberSeq           numberSeq;
    SalesLine           salesLine;
    SalesFormLetter     salesFormLetter;
    ;
    numberSeq = NumberSeq::newGetNumFromCode(SalesParameters::numRefSalesId().NumberSequence);

    salesTable.SalesId         = numberSeq.num();
    salesTable.TransactionCode = intrastatParameters.DefaultSalePurchase;
    salesTable.Transport       = intrastatParameters.TransportModeParm;
    salesTable.Port            = intrastatParameters.PortParm;
    salesTable.CustAccount     = "4015";

You can find more detail, including the download here at axaptapedia.

Written by gregondax

January 24, 2009 at 7:12 pm