Book Image

Microsoft Dynamics AX 2012 R3 Reporting Cookbook Update

Book Image

Microsoft Dynamics AX 2012 R3 Reporting Cookbook Update

Overview of this book

Table of Contents (17 chapters)
Microsoft Dynamics AX 2012 R3 Reporting Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Adding data methods in business logic


While display methods in AX can be accessed through the table methods exposed in the Query window, there can be small computational needs in every report. If these small computations cannot be implemented by expressions, then they can be handled by data methods. These are based on C# and can be used to leverage the C# framework capabilities for small computations. This recipe will showcase adding a data method to the report where a text in a selected field is made upper case.

How to do it…

  1. Right-click on the Data Methods node of your report data model to add a new data method.

    Adding a data method

  2. Rename the data method to changeCase.

  3. Double-click on the new data method and a new C# project with the name of the report will be added to the solution.

  4. The cursor will point to a plain implementation method that appears similar to this:

    [DataMethod (), PermissionSet (SecurityAction.Assert, Name = "FullTrust")]
        public static string DataMethod1()
        {
        throw...