Welcome at schweda.net | EN | DE
 
 
 
 
 
These posts are machine-translated.
Currently, only posts are displayed, which are relevant for Dynamics AX version »Axapta 3.0« Filter entfernen

Subscribe to RSS feed of this version

If you want to use a particular dimension as a dialog field in Dynamics AX 2009 (or earlier versions), you can create your own Extended Data Type (derived from Criterias) as described below. The decisive factors are the relations of this EDT.

In the example, the cost center is to be offered as a dialog field.

Screenshot EDT

The example code was taken from a class which extends runBase.


Find below a short example, how to add object nodes to a shared project through code.

static void AddNodeToSharedProject(Args _args)
{
    projectNode projectNode;
    TreeNode treeNode;
    #AOT
    #AOTExport

    projectNode    = infolog.projectRootNode();
    projectNode    = projectNode.AOTfindChild(#expProjectShared);
    projectNode    = projectNode.AOTfindChild('MyProject');
   
    // Add objects
    treenode = TreeNode::findNode(#TablesPath+'\\'+tableid2name(tablenum(CustGroup)));
    projectNode.addNode(treenode);

    treenode = TreeNode::findNode(#TablesPath+'\\'+tableid2name(tablenum(VendGroup)));
    projectNode.addNode(treenode);
   
    treenode = TreeNode::findNode(#ClassesPath+'\\'+classStr(PriceDisc));
    projectNode.addNode(treenode);
}

The so modified Project will look like this:

Screenshot


SysDictEnum SysDictEnum = new SysDictEnum(enumNum(SalesStatus));
int i;

for (i=0;i<SysDictEnum.values();i++)
{
    info(SysDictEnum.index2Label(i));
}

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);
    }
}

 


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


The following code is an example of how to build a query range based on a Form Data Source, which displays only "daily" records.

In the example the form-dataSource is named DataSourceName and it contains two date fields called FromDate and ToDate. Depending on a check box only records should be displayed, which that are valid for todays date.

public void applyFilter()
{
    queryBuildRange qbr;

    qbr = sysQuery::findOrCreateRange(DataSourceName_ds.queryBuildDataSource(), fieldNum(DataSourceName, recId));

    if( !ShowExpiredCheckBox.checked())
    {
        qbr.value(strfmt('('+
                         '((%5.%2 <= %1) && (%5.%3 >= %1)) || ' +
                         '((%5.%2 == %4) && (%5.%3 == %4)) || ' +
                         '((%5.%2 <= %1) && (%5.%3 == %4)) || ' +
                         '((%5.%3 >= %1) && (%5.%2 == %4)) ' +
                         ')',
                                Date2StrXpp(systemDateGet()),
                                fieldstr(DataSourceName, FromDate),
                                fieldstr(DataSourceName, ToDate),
                                Date2StrXpp(dateNull()),
                                tableId2name(tableNum(DataSourceName))));
    }
    else
    {
        qbr.value(SysQuery::valueUnlimited());
    }
}

The above method can be called for example in the executeQuery() of the DataSource.


Below you'll find a example, how to print a Text-document using X++.

static void printTextFileFromAX(Args _args)
{
    WinAPI::shellExecute("c:\\windows\\system32\\NOTEPAD.EXE",  @'/pt "c:\temp\test.txt" "An OneNote 2010 senden"');
}

Note: "An OneNote 2010 senden" is the name of the printer.


Pages 1 2 » 

 

 
Feeds
RSS RSS feed
 
 
posts of the actual month
November 2017
MoDiMiDoFrSaSo
 12345
6789101112
13141516171819
20212223242526
27282930 
 
 
© 2006-2016 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.