Thursday, 11 October 2012

Application file extensions


Dynamics AX uses a lot of file extensions, but luckily, there is a logic to them, so you can easily identify their purpose.
Most of these files are located in the application folder (AX 2009):
C:\Program Files\Microsoft Dynamics AX\50\Application\Appl\[your_application]
The extensions have 3 characters:
The first character indicates the owner of the file:
a: application
k: kernel
The second character indicates the content of the file:
l: label
o: object
t: text
d: developer documentation
h: help
And the third character indicates the type of file:
d: data
i: index
c: cache
t: temporary
Using this logic, we can easily name all file extensions, and understand their purpose.
In the application folder:
ALD extension: Application Label Data files
These files contain the labels and label comments for a specific language of a label file.
ALC extension: Application Label Cache files
These files contain the application label cache. These files can be deleted when the AOS is stopped.
ALI extension: Application Label Index files
The .ali files contain an index to the .ald files. These files can be deleted when the AOS is stopped.
ALT extension: Application Label Temporary files
These files contain new labels before they are committed to the .ald file.
AOI extension: Application Object Index file
The AOI file contains an index to the AOD files. You can delete this file when the AOS is stopped. Be sure to delete this when you have copied layers from one AX installation to an other.
ADD extension: Application Developer Documentation Data files
These files contain the documentation that is found under the Application Developer Documentation node. These files are localized, just like label files.
ADI extension: Application Developer Documentation Index files
This is the index to the ADD file.
AHD extension: Application Help Data files
The AHD file contains the documentation aimed at the end user. In the AOT, this is found in the “Application Documentation” node.
AHI extension: Application Help Index files
This is the index to the AHD file.
AOD extension: Application Object Data file
This is the ‘AX layer file’, each of these files represents one layer.
KHD extension: Kernel Help Documentation files
These files contain the kernel help documentation you can find in the AOT in the tree node System Documentation.
KHI extension: Kernel Help Index files
The KHI file is the index to the Kernel Help file.
Located in Server/bin:
KTD extension: Kernel Text Data file
This file contains system text strings. These are used in the interface of AX and for system messages.
KTI extension: Kernel Text Index file
This is the index to the KTD file.
Client side (not following the naming logic):
AUC extension: Application Unicode Object Cache file (as from AX 4.0)
This file is created on the client side, and is used to improve performance by caching AX objects. When you are in the situation where an AX client keeps using ‘old code’, or where something works on one client and not on the other, removing the AUC file might be the solution.
You can find this file in the directory C:\Documents and Settings\[USERNAME]\Local Settings\Application Data for xp, or C:\Users\USERNAME\AppData\Local for vista.
More information about object caching on Axaptapedia
AOC extension: Axapta Object Cache file (Untill Axapta 3)
This is the ‘old’ version of the AUC file but serves the same purpose.

Wednesday, 26 September 2012

How to add a image to a form in Ax 2009

Hi Friends,

Today we are going to add a image to form below the grid to diplay the related image.


In class declaration of your form declare a FormWindowControl (variable name - itemImage) and add a method on form of to load the images,
the code for form is as follows


void loadImage()
{
    Image img;
    ;

    //where FormDataSource is the datasource holding image
    if (FormDataSource.Image)
    {
        img = new Image();
        img.setData(FormDataSource.Image);
        itemImage.image(img);
    }
    else
    {
        itemImage.image(null);
    }
}

overirde the init method of the form as shown below:-

public void init()
{
    ;

    super();
    itemImage = element.design().control(control::Window);
}


Take a button under menuitem buton and name it as "save as"
to save the image which u have created  take a new method on form and write the following code

void saveImage()
{
    Image    img;
    Filename name;
    str      type;
    #File
    ;

    img = new Image();

    type = '.'+strlwr(enum2value(img.saveType()));

    name = WinAPI::getOpenFileName(element.hWnd(), [WinAPI::fileType(type),#AllFilesName+type], '', '');

    if (name)
    {
        ttsbegin;
        img.loadImage(name);
        
        //where FormDataSource is the datasource holding image
         FormDataSource.Image = img.getData();
         FormDataSource.write();
        ttscommit;
    }
}


Now, override the active method of formdatasource and place the code as shown below:-

public int active()
{
    int ret;

    ret = super();

    element.loadImage();

    return ret;
}

Also, override the clicked method of "Save as" button created above and place the code as shown below:-

void clicked()
{
    super();
    element.saveImage();
}

Final step:- Add a window control on the tabpage\group or the place where u want to display the image.

Thanks.

Wednesday, 5 September 2012

Setup Alerts in Dynamics Ax

This article describes how to set up Business Alerts in Microsoft Dynamics AX 4.0. This article also describes how to set the e-mail address from which Business Alert e-mail messages are sent.

MORE INFORMATION

Configure a user account to receive alerts

To configure a user account to receive alerts, follow these steps:
1. In the Navigation Pane, click Administration, and then click Users.
2. Select a user, and then click User Options.
3. Verify that the e-mail address where you want the user to receive alerts is in the E-mail field.
4. In the Receive alerts every (minutes) box, type 1.
5. In the Pop-up link destination list, click To alert.
6. In the Send alert as e-mail message list, click Define on each alert rule.
7. In the Show pop-ups list, click Define on each alert rule, and then click Apply.
8. Close the Options window.

Add the "E-mail distributor batch" job

The "E-mail distributor batch" job is the batch job that monitors and sends e-mail messages. To add the "E-mail distributor" batch job, follow these steps:
1. In the Navigation Pane, click Administration, expand Periodic, expand E-mail processing, and then click Batch.
2. In the "E-mail distributor batch" window, click Recurrence.
3. In the Recurrence window, click No end date.
4. Click Minutes.
5. In the Count box, type 1, and then click OK.
6. In the "E-mail distributor batch" window, click to select the Batch processing check box, and then click OK.Note You receive an Infolog message that resembles the following message:
Information: The E-mail distributor batch job is added to the batch queue.
7. Click Close to close the Infolog dialog box.
8. On the Tools menu, click Development tools, and then click Application Hierarchy Tree.
9. Expand Forms, and then double-click Tutorial_EventProcessor.
10. On the Tutorial_EventProcessor form, click Start, and then verify that the status is In waiting.

Set up a new alert rule

Alert rules define when alerts are sent and how they are received. To set up a new alert rule, follow these steps:
1. In the Navigation Pane, click General ledger, and then click Chart of accounts.
2. On the Overview tab, right-click a cell in the Account name column, and then click Create alert rule.
3. In the Alert me when area, select the field that you want to monitor with this alert rule in the Field list. For example, select Account name.
4. In the Event list, select the event that you want to trigger an alert. For example, select has changed.
5. In the Alert me for area, select the All records in Ledger chart of accounts option.
6. In the Alert me until area, select the No end date option.
7. In the Alert who area, select the user account that you want to receive this alert in the User ID list.
8. In the Also alert me by area, click to select the Show pop-ups check box.
9. Click to select the Send e-mail check box, and then click OK.
10. Close the "Manage alert rules" window.

Test the alert

To test the alert that you have set up, follow these steps:
1. In the Navigation Pane, click General ledger, and then click Chart of accounts.
2. On the Overview tab, change the name of the account for which you set up a new alert.
3. In the Navigation Pane, click Administration, click Periodic, click E-mail processing, and then click E-mail sending status.
4. The "E-mail sending status" window shows e-mail alerts that have been sent.

Set the e-mail address from which alerts are sent

You can set the e-mail address from which alerts are sent by selecting an e-mail template. To do this, follow these steps:
1. In the Navigation Pane, click Basic, click Alerts, and then click Alert parameters.
2. In the E-mail ID list, select the e-mail template from which you want e-mail alerts to be sent.

Wednesday, 23 May 2012

This product requires ASP.NET v2.0 to be set to ‘Allow’ in the list of Internet Information Services (IIS) Web Server Extensions


I’m currently performing a migration process and during the Moss installation the following error message is presented:

“This product requires ASP.NET v2.0 to be set to ‘Allow’ in the list of Internet Information Services (IIS) Web Server Extensions. If it is not available in the list, re-install ASP.NET v2.0.”
But on my machine Visual Studio 2005 and .NET2 are installed, so that’s a bit strange. Checking out the IIS extensions panel is indeed not showing the v2.0 version.
To solve the issue open your command prompt en navigate to:
%drive%\Windows\Microsoft.NET\Framework\v2.0.nnnnn
where nnnnn is the least significant version number of ASP.NET 2.0.
Now run the following command at the command prompt:
“aspnet_regiis.exe -iru -enable”
and the issue should be fixed.

Thursday, 10 May 2012

Tracing\ Performance check up of sql queries



The tracing provides the user to identify the time consuming SQL Queries, transactions and different code that executes on AOS. The performance could be measured and unnecessary load and process can be identified and avoidable.
AX10.jpg
RPC round-trips to server :This lets user to trace all RPC round-trips from client to the server.
X++ method : The calls traces all X++ methods that are invoked on the server.
Number of nested calls : Limits tracing to the specified number of nested method calls.
Function calls : Lets the user to trace all function calls that are invoked on the server.
SQL statements : Lets the user to trace all SQL Server statements that are invoked on the server.
Bind variables : Lets the user to trace all columns that are used as input bind variables.
Row fetch : Lets the user to trace all rows that are fetched using SQL Server
Row fetch summary (count and time) : Counts all rows that are fetched, and records the time spent fetching
Connect and disconnect : This option traces each time the AOS connects and disconnects from the database
Transactions: ttsBegin, ttsCommit, ttsAbort This option lets to trace all transactions that use the TTSBegin, TTSCommit, and TTSAbort statements

Performance Analyzer for Microsoft Dynamics

The Performance Analyzer for Dynamics is a tool which collects data from several Data Management Views (DMVs) and enables to
  • Investigate Blocking
  • Investigate SQL statements
  • Investigate Indexes
  • Investigate SQL Server configurations
For more information on this tool visit this site at http://archive.msdn.microsoft.com/DynamicsPerf

Code Profiler

The code profiler is used to calculate the X++ code execution time and the database activity time. When you start a Profiler and stop after execution, the information is stored in the database with the RunID. When you click on the Profiler runs, it will show all the RunID's and the tasks which were executed.
cp1.jpg
To avoid unnecessary disturbance of several tasks and want to use it for just a special task, you could use the following code. To execute this sample code change the Table Name and Column Name.
// This is a sample to show how to use code profiler for a specific user task.
static void execCodeProfiler(Args _args)
{
// replace YourTableName with Original Table Name
    YourTableName tableName; 
    Counter counter;
    ;

// profile start point.
#profileBegin("Test of profiler")
    while select tableName
    {
    // replace ColumnName with the Orginal Column Name
    info(strFmt("Table name: %1", tableName.ColumnName)); 
    counter++;
    if (counter >= 10)
    break;
    }
#profileEnd
// profile stop point.

} 
Now you can see the Run ID and other information in Profiler runs screen, basically this type of scenario is used when checking the performance of the object by running several times and checking the duration result.
cp.jpg

Data Migration



SystemSequences in Dynamics AX help to assign different set of numbers to RECID on every table.
There are several methods of migrating data in Dynamics AX. I noticed some issues with the memory, performance and troubleshooting, as typically the memory is managed in Dynamics AX by Kernel (windows system dll).
There are migration tools which also assist in migrating, no doubt they are awesome. But the developers can still migrate data with out using any third party tools. This could be achieved by just using SSIS 2005/2008. This is a very powerful ETL tool which microsoft has already provided. The developers should only know few tricks to handle RECID's and then it is easy to pull data from any Source database and migrate to the Dynamics AX destination database. The developers need to create and sync the RECID number of a table with the NEXTVAL from SystemSequences.
Below is the sample T-SQL code to know the next RECID number for a particular table. The ID of a table can be identified from the table properties.
--The below TSQL code will help to know the next RECID number for a Particular table.

DECLARE @TableIdNumber varchar(150) 
SET @TableIdNumber = 1   -- This ID Number belongs to [Address] table and is provided as a sample.

Select Convert(Varchar(50),NextVal) NextRecID from SystemSequences where name = 'SeqNo' and tabid = @TableIdNumber   
There are few list of ID's provided in the above excel sheet. Test the above code in SQL Server.
Note : Dynamics AX 2012 only supports SQL Server 2008.
These following tables are very important since these are not specific for one module. The entire Dynamics AX depends on these tables and they are used in every module.
VendGroup table contains definitions of all Vendor Groups.
VendTable table contains vendors information for accounts payable.
CustGroup table contains definitions of all Customer Groups.
CustTable table contains the list of customers for accounts receivable and customer relationship management.
DirPartyTable contains all Address of Customers , Vendors and etc, this is also know as Global address book.
The table DirPartyTable contains all the entries in the Global address book. The Global address book stores all the persons and organizations information which are used through out the system.

Using .NET framework directly in X++



This facilitates the developers having knowledge of the .Net Framework. They could use them directly in X++ to enhance the custom features in Dynamics AX.
static void main(Args args)
{
//  System.DateTime is from .Net Framework
//  This is a sample to show how the Framework can be used along with X++ coding.

    System.DateTime     now;
    str                 getDateStr;
    ;
    
    now = System.DateTime::get_Now();
    getDateStr = now.ToString();
    info("It is now : "+getDateStr);
}  
Developers could also develop and use the custom DLL's designed in Visual Studio 2008. In order to use the Custom DLL, it should be copied to the Dynamics AX installation path 'Client\Bin' folder. Adding references in Dynamics AX to those custom DLL's you can start using them in X++. The default path of deploying the new .Net DLL is as follows
[DRIVE]:\Program Files\Microsoft Dynamics AX\50\Client\Bin
Note : Dynamics AX 2012 only supports the higher version Visual Studio 2010 and .Net Framework 4.0.