Dynamics AX Blog - Dynamics AX 2012 - Posts from 2012

These posts are machine-translated.
Currently, only posts are displayed, which are relevant for Dynamics AX version »Dynamics AX 2012« Filter entfernen

RSS-Feed of this version
Currently, only posts from »2012« are displayed

hasField()-Method

I had already seen the situation that I wanted to know if a record has a particular field to be able to process the containing value. For example, within a method, which processes the calling args().

For example, in class SysDictTable the hasMethod() method is available, but i have not found a hasField() method so far.

Therefore I've created the following logic:

Common callingRecord;
itemId itemId;
SysDictField itemDictField;

itemDictField = SysDictField::findFieldByName(tableId2name(callingRecord.TableId), identifierStr(itemId));

if(itemDictField)
{
    itemId = callingRecord.(itemDictField.id());
}

 


 
 
 

AX 2012: SysOperation-Framework: Initalize parameters of a data contract

If you include the SysOperationInitializable class in a data contract using the implements command, the method initialize() gets available and can be overwritten.

This method can be used to initialize variables within the data contract. However, this method is only called as long as no usage data is found or it is not activated.

[DataContractAttribute]
class TutorialSysOperationDataContract
    implements SysOperationInitializable
{
    date dialogDate;
}

 

[DataMemberAttribute]
public TransDate parmDialogDate(TransDate _dialogDate = dialogDate)
{
    dialogDate = _dialogDate;
    return dialogDate;
}

 

public void initialize()
{
    dialogDate = systemDateGet() - 365;
}

 


 
 
 

AX 2012: Selecting the values of a financial dimension

The following job demonstrates how to display the values of a financial dimension - in the example Department - via X++.

static void getValues4Dimension(Args _args)
{
    DimensionValueService dimensionValueService;
    DimensionContract dimensionContract;
    List dimensionValueContractList;
    ListEnumerator listEnumerator ;
    DimensionValueContract dimensionValueContract;
    DimensionValue dimensionValue;

    dimensionValueService = new DimensionValueService();
    dimensionContract = new DimensionContract();
    dimensionContract.parmDimensionName('Department');
    dimensionValueContractList = dimensionValueService.getDimensionValues(dimensionContract);
    listEnumerator = dimensionValueContractList.getEnumerator();

    setPrefix(strFmt("Dimension %1: ", dimensionContract.parmDimensionName()));
    while(listEnumerator.moveNext())
    {
        dimensionValueContract = listEnumerator.current();
        dimensionValue = dimensionValueContract.parmValue();

        info(dimensionValue);
    }
}

 
 
 

 

 
 
 
Posts of the actual month
April 2012
MoTuWeThFrSaSu
 1
2345678
9101112131415
16171819202122
23242526272829
30 
 
© 2006-2025 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.