Book Image

Microsoft Dynamics AX 2012 R3 Reporting Cookbook

Book Image

Microsoft Dynamics AX 2012 R3 Reporting Cookbook

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

Modifying the report query in controller


Queries present the ability to add dynamic ranges to a report. Some situations demand ranges or sorting orders to be filled in, making it easier for the user. A good example would be an instance when a report is opened from the customer from which the range customer is prefilled. This recipe will handle this scenario of modifying queries through the controller class.

Getting Ready

This and the following recipes will use the PktRdlItemTransList report created in the first recipe.

How to do it...

  1. In your controller class, override the prepromptModifyContract method and write the following code:

    protected void prePromptModifyContract()
    {
        Query                   query;
        QueryBuildDataSource    qbds;
        InventTable             inventTable;
        
        //if an argument is received then see if it is inventTable
        inventTable = args ? args.record() as inventTable : null;
        
        if (inventTable.RecId)
        {
            //get the query associated with the report...