Friday, November 2, 2012

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;

Wednesday, October 31, 2012

How to enable / disable form control through code in Ax 2009

Hi Friends,

I was designed new form for one of the functionality and while opening the form i suppose to set the properties of form controls. For this i  used the following line code.

1. Set the Auto Declaration property to true for that form control.
2. In the general methods of the form override the init() method.
3. In Init method after super() i used the following code line to set the properties
    
    element.control(control::ControlName).enabled(false);
    E.g. element.control(control::ToDate).enabled(false);

4. While writing this line of code you will not get any intellisense after Control::
     You have to just type your control name and compile the method and it's done.

Hope this will help anyone.

Kiss'shor.. :)

Monday, October 29, 2012

Date functions in AX 2009

Hi....

These are some of the functions,from where we can get the day or month or year from the date...
Here is the below example....

static void date_Functions(Args _args)
{
    Transdate    d;
    ;
    
    d = today();
    
    info(strfmt("Date - %1",d));
    
    //Gets the month for the given date...
    info(strfmt("Month - %1",mthofYr(d)));
    
    //Gets the month name from the given date...
    info(strfmt("Month Name - %1",mthname(mthofYr(d))));
    
    //Gets the day for the given date...
    info(strfmt("Day - %1",dayOfMth(d)));
    
    //Gets the day name from the given date...
    info(strfmt("Day Name - %1",dayname(dayOfMth(d))));
    
    //Gets the year for the given date...
    info(strfmt("Year - %1",year(d)));
    
    //Gets the current weekday number from the date...
    info(strfmt("Weekday number - %1",dayOfwk(d)));
    
    //Gets the day of the year from the given date...
    info(strfmt("Day of year - %1",dayOfyr(d)));
    
    //Gets the week of the year from the given date...
    info(strfmt("Week of the year - %1",wkofyr(d)));
}

Source : http://kollidynamics.blogspot.in/search?updated-max=2011-08-27T02:41:00-07:00&max-results=4&start=8&by-date=false