Dynamics AX Blog - Posts from 2014 - Page 7

These posts are machine-translated.
Currently, only posts from »2014« are displayed

AX 2012: Enter financial dimension based on an form input

Sometimes you have the requirement that a certain financial dimension is to be set on the basis of an input in a form.

The following code example is something relatively easy to implement. In the example, whenever a particular field is changed - queried on the method modified() of the field of a DataSource, the financial dimension Costcenter will be filled with the value 25. If the value to be entered an invalid, nothing happens (error message or similar).

public void modified()
{
    DimensionAttribute DimensionAttribute = DimensionAttribute::findByName("Costcenter");
    DimensionValue newValue = '25';    // New dimension value
    
    super();
    
    dimensionDefaultingController.setDimensionAttributeValue(
        DimensionAttribute,
        DimensionAttributeValue::findByDimensionAttributeAndValue(DimensionAttribute, newValue).RecId, 
        newValue);
}

In the example, an existing instance of DimensionDefaultingController used.
 


 
 

Use macro within a SELECT statement

The SELECT-Statement in the example lists only active BOM items (Table BOM) on (active using the fields FromDate and ToDate). If the second parameter of the macro is empty (zero date ()), so all BOM items are listed.

static void useMacroInSelectStatement(Args _args)
{
    bom bom;
    date emptyDate;
    
    // parameters: %1 = table instance, %2 date, %3 empty date value
    #localmacro.bomDateFilter
        && ( %2 == dateNull() || (
            ((%1.FromDate <= %2) && (%1.ToDate >= %2)) ||
            ((%1.FromDate == %3) && (%1.ToDate == %3)) ||
            ((%1.FromDate <= %2) && (%1.ToDate == %3)) ||
            ((%1.FromDate == %3) && (%1.ToDate >= %2))
            ))
    #endMacro
    ;
    
    while select bom
    where bom.ItemId == '123'
    #bomDateFilter(bom, systemDateGet(), emptyDate)
    {
        info(bom.bomid);
    }
}

 
 

Which fields are shown in an auto-generated lookup?

I was asked this question recently and was not able to answer.

But i still knew that i had seen a page where this is explained in detail. But i knew neither find it manually nor using various search engines.

But in old documents of mine i found the source then, the trick to find it using search engines, is using the old name of Microsoft Dynamics AX - Axapta to look for it!

Do this, you will quickly find following page:

http://www.axaptapedia.com/index.php?title=Lookups


 
 
Pages « 1 ... 4 5 6 7 

 

 
 
 
Posts of the actual month
Juli 2014
MoTuWeThFrSaSu
 123456
78910111213
14151617181920
21222324252627
28293031 
 
© 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.