This post is machine-translated. The original post in german language can be found here.

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);
    }
}
These post applies to following versions:
Axapta 2.5, Axapta 3.0, Dynamics AX 4.0, Dynamics AX 2009, Dynamics AX 2012

anonymous 01/26/2014 09:13 | #1


Heinz Schweda 02/14/2014 17:37 | #2


Add comment
 
 

 

 
 
 
Posts of the actual month
Oktober 2021
MoTuWeThFrSaSu
 123
45678910
11121314151617
18192021222324
25262728293031
 
© 2006-2021 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.