Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Thursday, October 24, 2013

Creating & Using the find() methods in Dynamic AX 2012

Hi,
1. Create a table,
2. Use the 2 EDTs and make it one as index as unique by property AllowDuplicates : NO
3. Create a find method in the table using below code and patten

static TableName find(UsedEDT _UsedEDT ,
                       boolean          _forUpdate = false,
                       ConcurrencyModel _concurrencyModel = ConcurrencyModel::Auto)
{
    TableName  tableName ;

    if (_UsedEDT)
    {
        if (_forUpdate)
        {
            tableName .selectForUpdate  (_forUpdate);
            if (_concurrencyModel != ConcurrencyModel::Auto)
                tableName .concurrencyModel(_concurrencyModel);
        }
        tableName .selectLocked     (_forUpdate);

        select firstonly tableName
            index hint UsedEDTIndex
            where tableName.UsedEDT == _UsedEDT ;
    }

    return     tableName ;
}
/************************Using the find method **********************/
Using the display method with find() we can get that value by using below codes in the table.
display Name name()
{
    return TableName::find(this.UsedEDT).name();
}

Vertical splitter in forms (Dynamic AX 2012)

Hi,

1. Create a group inside the main group
note: between the two groups

2. In property window of that group
Autodeclaration  :Yes
Style  : SplitterVerticalContainer

3.In the class declaration of that form use below code
public class FormRun extends ObjectRun
{
    SysFormSplitter_X    m_vSplitter;
}

4. In the init method of the form use below code pattern

public void init()
{
    ;
    super();
    m_vSplitter = new SysFormSplitter_X(vSplitter, gridContainer, element);
}


How to invoke and iterate List as Contract methods in AX 2012/ D365

Hi, Public void performContractIterate(ClassContainsListAsContract    _ListCarryClass) { List contractFieldList = new List(Types::Class); ...