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

Hiding controls by context


Among the customizations done in a report, one of the most common is to disable certain report controls by context. This recipe will showcase how to hide a report control in the report design using the context.

How to do it…

  1. Create a new report in Visual Studio with the CustTable query as the data source.

  2. Add an auto design and drag the data source to the design.

  3. In the Parameters node, add a new parameter of type Boolean and call it HiddenParm. Set its properties as follows:

    Property

    Value

    Nullable

    True

    AllowBlank

    True

    Default Value

    False

  4. In the Designs node, navigate to the control which must be toggled based on the flag. In the Properties window, set the visible property through expression to point to the newly added parameter using the following expression:

    =Not(!Parameter.HiddenParm.Value)
  5. The next step is to set this flag from the controller based on the context. To do this, navigate to the controller class and in the preRunModifyContract method, access...