Friday, November 26, 2010

How to export data of some selected tables?

Sometimes when you want to share data in your tables with others, you export it from Administration -> Periodic -> Data export/import -> Export to. But this exports data in all your tables. What if you want to export data from selected tables only? Here is how you can do that.

First create a definition group from Administration -> Periodic -> Data export/import -> Definitions group

In the definition group form, create a new group. Name it XYZ.
Click on Table setup button.
By default, the table setup form has all the tables listed, select and delete all of them.
Now add only the tables you want data to be exported for.
Now click on Administration -> Periodic -> Data export/import -> Export to
In the definition group, specify the group we created above and click OK

In this way, you can export data for selected tables only.

Wednesday, November 24, 2010

EP development Webinar

While exploring the features and customizations on Enterprise portal of dynamics AX. I've came accross a very useful webinar from Channel 9. Diwakar explains the architecture and development in EP with six live demos. I really recommend this video for novoice to expert EP developers.
http://channel9.msdn.com/Blogs/diwakarb/Dynamics-AX-Enterprise-Portal-Development-Webinar

Tuesday, November 23, 2010

Trade and Logistics training

Hi. There is a blog that I would recommend a free blog that gives a very good insight to the main supplychain processes in standard Dynamics AX.
Take a look at the blog http://www.dynamicsaxtraining.com/ that Volodymyr Myronenko is maintaining.
I recommend all new Dynamics AX consultants and developers to look into this blog. It sure give a overall starting point.

Happy blogging.

Wednesday, November 10, 2010

How to Install Dynamics AX 2009 on Windows 7

Recently, when I upgraded my laptop to Windows 7, I decided to install Dynamics AX 2009 on it. Since my computer is not a domain computer so I was unable to even initiate the installer. The reason behind this blockage is that when it compares the name of computer with the local computer it found the same and installation stops.
I made following changes to the registry and then I was able to initiate Installer.

Open registry and go to the path
HKEY_LOCAL_MACHINE | System | Current control set | Computer Name | Active computer Name and change the computer name to some other name.

I modified my Active computer name to some other name and then run the installer. This time it couldn't match the computer active name. However, it gave me warning that the version you are going to use is not compatible and you should install some windows server *.I just ignored the errors. This is not enough. you may have to make some more changes and manual installation of server on your machine. Though it is a bit complicated process for windows 7. However, it is possible!!.

When I was having errors on AOS installation, I followed the guidelines as per this video, it helped me alot
http://www.trainer-it.ru/video/video-ms-ax/video

Though the environment is Russian. However, demonstration is in english. It will be very helpfull for you guys to see and made the changes as described in this video

Once the installation finished undo the registry changes that you've done before.

By this way, you can install Dynamics AX 2009 on windows 7.

Tuesday, November 2, 2010

Enum values in Query ranges

I've come accross a very geniun mistake which most of the developers usually do. Specially those who are working on a single language and donot test their code properly for other languages. This is related to the use of Enum values in Query ranges.

public void init()
{
QueryBuildRange criteriaOpen;
;
super();
criteriaOpen = this.query().dataSourceTable(tableNum(ProdTable)).addRange(fieldnum(ProdTable, ProdStatus));
criteriaOpen.value("Started");
// it does not work in non-English interface!!!

Though you will not find any compilation or run time error with this. However, the query will not read value when you run it in non english environment.

The correct way to use enum in query is

criteriaOpen.value(QueryValue(ProdStatus::StartedUp);
}

Sunday, May 23, 2010

Random and Sequence number Generation in AX

Ax provides us with two classes for this purpose. I am just giving an example on how to create random numbers and numbers in sequence by using them.

Random numbers:
static void RandomNumbers(Args _args)
{
RandomGenerate RandomRange = new RandomGenerate();
Random Random = new Random();
;
//This generates random numbers within the given range
info(int2Str(RandomRange.randomInt(20,100)));

//This generates random numbers
info(int2Str(Random.nextInt()));
}

Numbers generated can be repeated. So you should make some explicit validations if unique number is required.

Sequence numbers:

static void Sequence(Args _args)
{
Sequence Seq = new Sequence("Sequence",8,100,500,1);
// Displays the current value of the object
print Seq.currval();
while(1)
{
print Seq.nextval(10);
pause;
}
}
Sequence class takes the following parameters:
SequenceName ('Sequence') = It can be any string.
Identification No ('8') = Identification number for the sequence.
Initial Value ('100') = Initial value.
Maximum value ('500') = Maximum value.
Flag('1') = It indicates whether the cycle should repeat after maximum value.

The method “nextVal” takes the value to be incremented for next number as parameter.

Execute a string expression in X++

Sometimes we need to execute a string expression in X++. This may be the case when we need to take the full expression as input from the user and then to execute it. To do this we need to create a method which basically returns the string expression. Then pass this method runBuf() for execution as shown,

static void executeExpression(Args _args)
{
str expr = '2 * (16/8)';
str method = @'real calculate(){return ' + expr + ';}';
real result;
;
result = runBuf(method);
info (strfmt("Calculation result is %1", result));
}
This job will display an infolog of

Calculation result is 4