Monday, July 16, 2018

Develop Reports

All reports in Microsoft Dynamics AX 2012 are developed by using Visual
Studio. Default reports that are installed with Microsoft Dynamics AX 2012 can
be customized and new reports can be created by using Visual Studio.


Create New Reports

To create a new report, you must create a report project in Visual Studio, add a
new report and report design to the project, and then define data and parameters.
The report project is then imported in to Microsoft Dynamics AX 2012 and then
the report is deployed to the Report Server. A menu item can then be created to
launch the report, or the report can be added to a Role Center or Enterprise Portal
web part.


Create a Reporting Project

To create a new report, begin by creating a new reporting project in Visual
Studio. Follow these steps to create a new reporting project:


1. In Visual Studio, select
File > New > Project from the menu.

2. Select Microsoft Dynamics AX for the project template type and
then select the report model template.


3. Enter a project and solution name.
 

4. Verify the path for the location where the project file will be saved.

5. Click
OK.



To add a new report to the project, select the Project in Solution Explorer in
Visual Studio. Right-click the project and select
Add > Report.

Instead of creating a new Reporting Project, you might want to use an existing,
pre-defined Reporting Project. Follow these steps to add an existing Reporting
Project from another solution:


1. Select the solution in Solution Explorer in Visual Studio. Right-click
the solution and then click
Add > Existing Project.

2. Select the reporting project to add, and then click
Open.

When you add an existing reporting project from another solution, the project
files are not copied to the directory that contains the files for the solution.
Instead, the project files from the original solution are used.


You can also add an existing report from the AOT that is displayed in the
Application Manager in Visual Studio. Follow these steps to add an existing
report to the current project:


1. In Visual Studio, open a solution and select a project in the Solution
Explorer.


2. In Application Explorer, expand the SSRS Reports node and then
expand the Reports node. Find the report that you want to add to the
project.


3. Right-click the report and select
Add to Project. The report is added
to the current project.
 

Define a Data Source

To add data for your reports, a data source must be added to the report project.
An existing data source is used to connect to the Microsoft Dynamics AX 2012
application database. When the predefined Microsoft Dynamics AX data source
is used, all data access requests go through the MorphX security system.


If you want to use a database other than the Microsoft Dynamics AX 2012
application database, you must define a new data source to specify connection
information and a provider type for that database. Follow these steps to define a
report data source:


1. In Visual Studio Solution Explorer, right-click the reporting project
that you want to add a report data source to, select Add, and then
click
Report Data source. This is a model that contains a single
report data source.


2. Type a name for the model. The file name extension of a model is
.moxl.




Define a Dataset

A report dataset selects data from the data source to be displayed in a report. You
can use a query, stored procedure, enum, or a data method to select data.


1. Double-click the report in the project in Visual Studio Solution
Explorer to open the report in the Model Editor.


2. In the Model Editor, expand the node for the report that you want to
work with.


3. Right-click the Datasets node, and then click
Add Dataset.

4. Select the node for the dataset.
 

5. In the Properties window, set the following properties.

o Data Source - Select the Microsoft Dynamics AX data source,
or a new data source that was created.


o Data Source Type - Select the type of data source that you will
use to select data. If the existing Microsoft Dynamics AX data
source is selected, you can choose from the following:


a.
Query - use a query from the AOT

b.
Business Logic - use a data method from the report project

c.
Report Data Provider - use the results of an X++ class

d.
AX Enum Provider - use an enum from the AOT

o Name - Enter a name for the dataset.

o Query - Select a query, method, class or enum to use to retrieve
the data from the data source.


o Default Layout - default layout to be used for Auto Design
reports. Dynamic Filters - enables filters to be used in the report
dialog.
 



Define a Data Region

A data region is an area in a report that displays data from a dataset. To add a
data region to an auto design report, drag a dataset onto a report design. A data
region can also be added manually. Follow these steps to add a data region to an
auto design report:


1. In the Visual Studio Model Editor, select the dataset for the report
where you want to create a data region.


2. In the
Properties window, verify the appropriate Default Layout
property is selected.


3. To create a new auto design, drag the dataset onto the Designs node
for the report. To add the data region to an existing auto design, drag
the dataset onto the node for the auto design. A node for the data
region is created under the Designs node.


4. Select the new data region. In the
Properties window, specify a style
template.


5. Preview the report to verify the data region is correct. Right-click the
design and select
Preview.

Follow these steps to manually add a data region:


1. In the Visual Studio Model Editor, select the auto design for the
report that you want to create a data region.


2. Right-click the auto design, click
Add, and select a data region type.
Select from: List, Matrix, Pie or Doughnut Chart, Table, or XY
Chart.


3. Select the new data region. In the
Properties window, specify a
dataset and a style template.


4. Preview the report to verify the data region is correct. Right-click the
design and select
Preview.

Define a Report Filter

Filters are used to filter data that is displayed in a report. Set ranges can be
defined to filter data on a report. If the Dynamic Filter property on the dataset is
set to True, the report user will identify the ranges when he or she views the
report. If the Dynamic Filter property on the dataset is set to False, the report
developer must specify the data ranges. Use the following procedure manually


define a filter for a data region:


1. In the Visual Studio Model Editor, select the design to modify in the
Design node under the report to edit.


2. Expand the node for the auto design to view its data regions.


3. Select the Filter node under the data region. Right-click the Filters
node, and then click Add Filter.
 

4. Select the new filter and specify the following properties:

o Expression - select an expression or select <Expression...> to
open an Edit Expression dialog box

o Name - enter a name for the expression

o Operator - select an operator for the expression

o Value - enter a value for the filter 

Best Regards,
Hossein Karimi

No comments:

Post a Comment

Configure the Firewall on the Enterprise Portal Server

After you install Enterprise Portal, enable Web Server (HTTP) in Windows Firewall. If you do not enable the web server in Windows Firewall...