
Wednesday, March 31, 2010
How to set the language used on forms and menus

Tuesday, March 30, 2010
Fun and games with Ax
An overview:




How to filter records in a form by code
Using this filter functionality in your code is something you'll definitely use at some point in time as a programmer.
Although it's possible to do it in a single line of code, I prefer a 3 step solution. That way it's more flexible.
Let me show you by example. We'll filter the customers records in form CustTable, only showing customers with currency USD.
Step 1: Declare a class variable
In the ClassDeclaration method of the form, define a range.
QueryBuildRange CurrencyQBR;
Step 2: Instantiate the new range.
In the init method on the datasource of the form, you assign the range to a specific field (after the super call).
public void init()
{
super();
CurrencyQBR = this.query().dataSourceName('CustTable').addRange(fieldnum(CustTable,Currency));
}
Step 3: In the last step, you assign a value to the range.
This is done in the executeQuery method on the same datasource of the form. Before the super call. Like this:
public void executeQuery()
{ ;
CurrencyQBR.value(queryvalue('USD'));
super();
}
You're done! When you open the form, your customer records are filtered, you only get the customers with currencycode USD set up.

Like I said in the intro of this post, this can be done in one line of code as well.
In the init method of the form datasource, after the super call, place this code:
this.query().dataSourceName('CustTable').addRange(fieldnum(CustTable,Currency)).value(queryvalue('USD'));
But this way, it's fixed. If you choose the 3 step method, you could for example use a variable in the range value. The way to go would be to place an input field on your form, get the value from it and supply it in the executeQuery method.
For example like this:
public void executeQuery()
{ ;
CurrencyQBR.value(queryvalue(MyInputField.text()));
super();
}
Just make sure the executeQuery method is executed, thus applying the desired filter (maybe be using a button on your form to activate it).
Of course it's possible to combine multiple querybuildranges.
Thursday, March 25, 2010
How to create a GUID in Ax
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 { }.
Wednesday, March 24, 2010
More information about the AUC file
AUC is short for Application Unicode Cache.
What is the AUC file used for?
The file contains a cache. Objects of the application object tree from Ax are stored locally, so that they don't have to be read from the AOS server over and over again.
So it should speed things up a bit.
Where can you find the AUC file?
This cache file is stored together with the user profile information. And as so it's location varies according to the operating system version used.
You can find it in following folder:
Windows XP and Windows 2003
C:\Documents and Settings\%username%\Local Settings\Application Data
Windows Vista, Windows 7 and Windows 2008
C:\Users\%username%\AppData\Local
Can you delete the AUC file?
Barack Obama and I agree: Yes you can!
Close your Ax client session, delete the AUC file. The AUC file gets recreated automatically next time you logon to Ax.
How is the naming of the AUC file defined?
In older Ax versions (3 and 4), the filename for the cache file is based on the AOS name, server name etc. In Ax 2009, the name is based on a GUID. The GUID used is the one you can find in the Ax table SysSqmSettings (field GlobalGuid).
As such, watch out with duplicating databases for test purposes. You don't want 2 Ax server instances using the same GUID and as such the same cache file, as this will lead to unexpected results. (Should this happen: Replace the GUID in table SysSqmSettings with an empty one. A new GUID will be created by the AOS at restart.)
Tuesday, March 23, 2010
The Cloud
Maybe you've worked with it. Or only had a short test drive with it.
What am I talking about? The cloud.
Or to be more precise: Microsoft's offering for the cloud. What's in?
Over at ZDNet, they do not believe in Microsoft as a serious cloud contender. A very critical voice is heard on Microsoft's cloud offering in this article, titled 'Why Microsoft really, really, hates the cloud'.
Summing it up: In 5 years Microsoft's operating income will drop by 75 %. Because it cannot adapt to the changing IT environment.
My opinion, for what it is worth: A bit over simplified reasoning in this article.
Will we see a move to cloud based applications: Absolutely. Your communications will be without doubt cloud based. Email only being one of them.
Your basic word processing, spreadsheet functions will be cloud based. I can dig that. Image, audio and video management, sure.
But your business critical applications like an ERP system? I don't think so. Partially maybe.
Small companies (-25 employees) will be interested. But anything above that?
I also do not see a reason on why Microsoft cannot adapt and change it's income pattern (that's without doubt needed). But are Cisco or IBM better positioned then Microsoft in this area then?
Microsoft is not postponing the arrival of Cloud Computing as stated in the article at ZDNet. It's just gearing up things and when and where there is money to be made with the Cloud, Microsoft will be around.
Remember the spread sheet. Lotus 1-2-3 was once number one. And the word processor, with WordPerfect. Or the internet browser.
Maybe this time around Microsoft's rival isn't another software company.
Wednesday, March 17, 2010
How to get rid of the report scaling message the lazy way
Now Ax will inform you that the report has been rescaled (Report is scaled xx percent to fit to page) and this message is generally not well received by users.

Users are annoyed by the message, they get it every time they run the report, they cannot do anything about it, they have to click to close the infolog, ...
Ax has a builtin feature to suppress this scaling message. You can modify the init method of your report, and add something like this:
this.printJobSettings().suppressScalingMessage(true);
This is very effective and will do the job.
Only, this requires you to modify every report with these kind of messages.
A nicer way would be if we could switch it off in one place for all reports. Fortunately, this is possible as well.
Go to class SysReportRun, in the Run method, place following code before the call to super:
if(this.printJobSettings())
this.printJobSettings().suppressScalingMessage(true);

Now we don't have to modify each and every report and our users are happy.
Note that you can still override the settings in your report. In some reports this is done by default, like SalesInvoice and SalesConfirm.