Dynamics AX Blog - Posts from June 2016

These posts are machine-translated.
Currently, only posts from »June 2016« are displayed Filter entfernen

Find missing labels in a specific language

Recently, I had to find out if a label exists in a certain language (in the example de_at), or not. Well suited for it seems the following SQL statement.

SELECT *
FROM [AX2012R3_TEST_model].[dbo].[ModelElementLabel] as existing
where existing.Module = 'myModule'
and existing.Language = 'en_us'
and not exists
( select *
from [AX2012R3_TEST_model].[dbo].[ModelElementLabel] as missing
where missing.labelid = existing.LabelId
and missing.Module = existing.Module
and missing.Language = 'de_at')

 
 
 

Detect/Respond on changing the edit mode

To respond in a form to change the edit mode, you can see the task () - Override method of the form as follows:

public int task(int _taskId)
{
    int ret;
    #Task
    ret = super(_taskId);
    
    switch(_taskId)
    {
        case #taskEditRecord:    
            …doSomething… 
            break;
    }
    return ret;
}

 

To get the current edit mode you may use the following method:

element.inViewMode()

 
 
 

Use special characters in the XML-header of a method

Sometimes you have to use special characters in the XML header of a method to document the code well. To get sure, that this header is still well-formed and is not identified as best practice deviation, you can use a CDATA section.

/// <version>
///  1.0
/// </version>
/// <summary>
/// <![CDATA[ Replaces following special characters: &, % ]]>
/// </summary>
private void someMethod()
{
    //...do something...
}

Without this CDATA section AX would spend the following BP-Deviation:

 

XML documentation is not well-formed.

 


 
 
 

Get design names of a SSRS report

Anyone who has the need to get the available designs of a SSRS report, can use the following job.

static void listDesignsOfSSRSReport(Args _args)
{
    TreeNode treeNode;
    TreeNode treeNodeDesign;
    #aot
  
    treeNode = TreeNode::findNode(#SSRSReportsPath + #AOTRootPath);
    treeNode = treeNode.AOTfindChild("SalesPackingSlip");
    treeNodeDesign = treeNode.AOTfindChild("Designs");
  
    treeNodeDesign =
    treeNodeDesign.AOTfirstChild();
    while(treeNodeDesign)
    {
        info(treeNodeDesign.AOTname());   
      
        treeNodeDesign = treeNodeDesign.AOTnextSibling();
    }
}

 
 
 

 

 
 
 
Posts of the actual month
June 2016
MoTuWeThFrSaSu
 12345
6789101112
13141516171819
20212223242526
27282930 
 
© 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.