Mar 29, 2012

RecId details in AX


As we know that Dynamics Ax uses recid(Record Id) to uniquelly identify a record in the database. 

Advantage of RecId
 

1.By default system uses Recid (surrogate Key) as primary index, so if query optimizer didn't find any index to use then it will use RecId.

Dyamics Ax uses
 SystemSequence class(AOT->SystemDocumentation->Classes) to generate recId for table.
Using SystemSequence class you can reserve RECID's for your table.

Ax Kernel uses SystemSequences Table to generate the Recid for table as shown below
Goto AOT-> SystemDocumentation->Tables->SystemSequences ,

Mar 28, 2012

How to use ternary operator?


static void intro_ternaryOperator(Args _args)
{
    Boolean         a = true;
    ;
    info(a?"Customer name":"Coustomer account");

}

How to get dataAreaId ?


static void DataDic_ChangeCompany(Args _args)
{
    DataArea dataArea;
    CustTable custTable;
    ;
    while select dataArea
    {
        if (!dataArea.isVirtual)
        {
        info(strfmt("Company: %1", dataArea.Id));
            changeCompany(dataArea.id)
            {
            custTable = null;
                while select custTable
                {
                info(strfmt("%1, %2", custTable.dataAreaId, custTable.accountNum));
                }
            }
        }
    }
}