Friday, November 2, 2012

Make Form/Report run automatically when dynamics Ax Starts

When ax starts Kernel Creates an instance of Info class . 
Info contains StartupPost() method used to execute the code every time ax starts.

Following example opens InventTable Form automatically when you start ax.

void startupPost()
{
SysSetupFormRun formRun;
Args args = new Args();
;

args.name(formstr(InventTable));
formRun = classfactory::formRunClassOnClient(args);
formRun.init();
formRun.run();
formRun.detach();
}

So if you have any task that has to be executed every time ax start , then this is the best place to put your code.

Source : http://learnax.blogspot.in/search?updated-min=2010-01-01T00:00:00-08:00&updated-max=2011-01-01T00:00:00-08:00&max-results=50

Axapta(X++) Glossary with their definition

Widely used Axapta Terms and their Definition

ALC

Microsoft Dynamics AX Label Description files have the extension .alc. Also see ALD and ALI. 

ALD

Label data files have the extension .ald (AX Label Data). Also see ALC and ALI. 

ALI

Microsoft Dynamics AX Label Index files have the extension .ali. Also see ALC and ALD. 

AOS

Application Object Server is windows service used to coordinate with different components of Dynamics Ax. 

AOT

Application object tree , repository that stores metadata information about the objects created in Axapta.

Base data

Data which is customer-dependent. Examples: Customers, Vendors, Items. 
This is often data from an existing system, which must be entered or imported into 
Microsoft Axapta. 


Control

Graphical object, such as a text box or command button that you put on a form or 
report to display data, perform an action, or make the form or report easier to 
read. 

CRUD

An abbreviation for the four basic database operations: Create, Read, Update, 
Delete. 

DCOM

Distributed COM 

Default data

Data which is customer-independent. Examples: Zip codes, Address formats, Time 
Intervals, Units, Unit conversions, VAT parameters, Transaction texts. 
Note 
When a user modifies default data, it becomes custom data, which is customer- 
dependent. This means that default data can sometimes be customer dependent, 
because of historic reasons, such as Chart of Accounts. 

Domain 

Collection of one or more companies. Domains enable you to define user groups that 
have the same permissions in more than one company while allowing the same user 
groups to have other permissions within other companies. 

EDT

Extended Data Type: a user-defined data type based on a primitive data type or 
container. 

IDE

Integrated Development Environment. MorphX is the Microsoft Dynamics AX IDE. 

IntelliMorph

The Runtime Environment embedded in Microsoft Dynamics AX, that draws menus, forms, 
and reports for Windows- and Web-clients with the correct contents, size, and 
layout according to: 
the language your texts are displayed in. 
what features you can access. 
how wide you want the fields on your installation. 
the formats you are using for dates and numbers. 

MorphX

The Development Environment of Microsoft Dynamics AX, including: 
Data Dictionary 
Tools for creating menus, forms and reports for Windows- and Web clients 
Compiler and debugger for the object oriented programming language X++ 
Version control system 
Label (multi language text) systems 

Overload

Provide more than one method with the same name but with different signatures to 
distinguish them. 
Overloading is not supported by X++. Also see override. 

Override

Replace the superclass's implementation of a method with one of your own. The 
signatures must be identical. 

Note 
Only non-static methods may be overridden. 

Record ID 

A record ID uniquely identifies a row of data in a table. Record IDs are integers. They are assigned and managed by Microsoft Dynamics AX. 

super () 

Reference to the system class that contains the required method. When super() is used, the system method is automatically used. 

this 

Reference to the current object. this is frequently used as a parameter to methods 
that need an object reference.for e.g at Table level if it used gives you the 
selected record. 

TTS 

Transaction Tracking System. For more information, see Transaction Integrity. 

WinAPI

Windows Application Programming Interface. Contains System level API's 
like "WinAPI::shellExecute("file.exe");" for opening applications from axapta.

Source : http://learnax.blogspot.in/2010_01_01_archive.html

For Ax Developers

Keep following things in your mind before you start coding in Ax.

1. Whenever you came accross new functionality , don't start coding immediately please first cross check whether the same/similar kind of functionality is there in the standard product. By doing so you will save time for coding,learn ax coding style and also this will help you to understand the various functionalities in the standard product.

2. Start with pseudo-code , just draw sketch on paper how you want the data to flow , which will help you in understanding the different override methods in Axapta.

3. Code should be modular , Instead of writing all the code in one method please write plug and play functions.

Source :http://learnax.blogspot.in/2010_01_01_archive.html

X++ Code Optimzation

Following are the coding tips to improve your Axapta system's performance:
1. Smart Joins : Try to Use Joins instead of nested while loop 
wherever possible.
2. Select Statement : Mention the field names in the select statement 
instead of feteching entire row , this will reduce 
data amount to transfer from database.
e.g " Select Itemid from inventTable "

3. Display Methods : Make sure that generic display methods should be 
moved at table level and cached by 
using"Formdatasource.cacheAddmethod". 
4. Local caching : Use Variables for storing the constantly used 
caculated values in loop , by doing so you can 
reduce the calls to the database and different 
layers.
5. Monitor the Database Calls : For bulk records 
updation,deletion,insertion use 
RecordSet Based operator like 
update_recordset , delete_from and insert_recordset .
6. Aggregate Function: Use sum, avg, minof, maxof and count where 
applicable. Because this can utilize the database’s 
built-in function instead of calculating and analyse 
data in Axapta.

Source : http://learnax.blogspot.in/2010_01_01_archive.html

Copying License in Dynamics Ax


Axapta stores the License data in the following two tables.

1.SysLicenseCodeSort
2.SysConfig

So if you copy data of these tables(from Running instance) and import at your instance , this will serve your purpose.

Thursday, November 1, 2012

Temporary data insert



CustTable  CustTableTmp;
;
CustTableTmp.setTmp();
while select CustTable
{
    CustTableTmp.data(CustTable.data());
    CustTableTmp.doInsert();
}

Select CustTableTmp;