Académique Documents
Professionnel Documents
Culture Documents
Introduction
SQL Server Reporting Services (SSRS) is the primary framework for developing
reports in Microsoft Dynamics AX 2012. The installation requirements include
completing tasks such as verifying prerequisite components are installed,
completing the installation setup wizard and deploying default reports. With
SSRS, users can develop and deploy reports and integrate reports with Microsoft
Dynamics AX 2012.
2-1
Reporting in Microsoft Dynamics AX 2012
SSRS provides data that can be displayed in many different clients including:
Microsoft Dynamics AX clients, Enterprise Portal, and batch jobs.
2-2
Chapter 2: SQL Server Reporting Services
All the standard reports that are provided with Microsoft Dynamics AX 2012 use
the SSRS reporting framework. When you upgrade from an earlier version of
Microsoft Dynamics AX, legacy reports and cubes are not upgraded. Reports that
use the X++ reporting framework and existing SQL Server Reporting Services
reports will be copied to the Microsoft Dynamics AX 2012 system. However,
they will not be upgraded.
Installation
Microsoft SQL Server Reporting Services (SSRS) is installed as part of the SQL
Server installation. Microsoft Dynamics AX 2012 employs Reporting Services
Extensions to make use of SSRS capabilities. The Reporting Services Extensions
are installed and configured as part of the Business Intelligence installation
during the Microsoft Dynamics AX 2012 installation. Refer to the Microsoft
Dynamics AX 2012 Installation Guide for more information. The Business
Intelligence components can be installed separately if they were not installed
during the Microsoft Dynamics AX 2012 installation.
Prerequisites
Before you install the Business Intelligence components, check that the
prerequisites are met. Run the Microsoft Dynamics AX prerequisite validation
utility to determine whether a computer meets the requirements to install a
Microsoft Dynamics AX component.
2-3
Reporting in Microsoft Dynamics AX 2012
Installation
To install the Business Intelligence components, run the Microsoft Dynamics AX
2012 setup. Refer to the Microsoft Dynamics AX 2012 Installation Guide for
more information. The installation setup wizard will perform the following
actions:
If the default reports are not deployed during the installation, they can be
deployed later using Windows PowerShell.
If you did not deploy the reports when you installed the Reporting Services
extensions, you can deploy them by using Windows PowerShell. The following
procedures can help you deploy the reports:
Complete the following procedure to open PowerShell and view a list of the
reports that are included with Microsoft Dynamics AX 2012.
2-4
Chapter 2: SQL Server Reporting Services
To modify and filter the list of default reports use the following commands:
To modify the list so that only the Name and ChangedDate fields
are displayed, enter the following command: $reports | Select-Object
Name,ChangedDate
To filter the list so that only specific reports are listed, enter
keywords or report names. For example, to filter the list so that only
reports that contain the word CustTrans are listed, enter the
following command: $reports | Select-Object Name,ChangedDate |
Where { $_.Name -like "CustTrans*" }
After you have retrieved a list of reports, you can deploy them. The Publish-
AXReport command is used to deploy the reports. The following examples show
how to use this command:
2-5
Reporting in Microsoft Dynamics AX 2012
The Application Object Tree (AOT) holds all the application objects that are used
to build Microsoft Dynamics AX. The AOT contains objects that will be used to
collect data for a report and objects that give users access to display reports.
The objects in the AOT are grouped into nodes according to their type. The AOT
objects include:
Other objects in the AOT are used to manage application processes and for
various other functions.
When you develop a report, objects from the AOT will be used to access data and
to display the reports.
Visual Studio
Microsoft Visual Studio is an integrated development environment that is used to
develop applications. Development in Visual Studio can be done using Visual
Basic, Visual C#, Visual C++, and other programming languages. Whereas many
development tasks in Microsoft Dynamics AX 2012 can be completed by using
X++ in the MorphX development environment or the Visual Studio development
environment, report development can only be done in Visual Studio.
2-6
Chapter 2: SQL Server Reporting Services
Application Explorer is a tool in Visual Studio that provides a view into the AOT
in Microsoft Dynamics AX. In Application Explorer, you can view and debug
X++ code in the AOT.
2-7
Reporting in Microsoft Dynamics AX 2012
With Reporting Services, you can create interactive, tabular, graphical, or free-
form reports from relational, multidimensional, or XML-based data sources. You
can publish reports or access reports on demand. Reporting Services also enables
you to create customized reports based on predefined models, and to interactively
explore data within the model. Additionally, you can select from a variety of
viewing formats or export reports to other applications. The reports that you
create can be viewed over a web-based connection or as part of a Microsoft
Windows application or SharePoint site.
Analysis Services helps you analyze large quantities of data. With it, you can
design, create, and manage cubes that contain detail and aggregated data from
multiple data sources.
For more information, see Chapter 3: SQL Server Analysis Services of this
manual.
2-8
Chapter 2: SQL Server Reporting Services
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.
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.
2-9
Reporting in Microsoft Dynamics AX 2012
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:
2-10
Chapter 2: SQL Server Reporting Services
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:
2-11
Reporting in Microsoft Dynamics AX 2012
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:
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.
2-12
Chapter 2: SQL Server Reporting Services
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.
2-13
Reporting in Microsoft Dynamics AX 2012
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.
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.
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.
2-14
Chapter 2: SQL Server Reporting Services
1. In the Visual Studio Model Editor, select the data region in the
design node for the report to sort.
2. To define a sort order outside a grouping, right-click the Sorting
node, and then click Add Sort. To define a sort order within a
grouping expand the node for the grouping, right-click the Sorting
node, and then click Add Sort.
2-15
Reporting in Microsoft Dynamics AX 2012
2-16
Chapter 2: SQL Server Reporting Services
External images can only be used for Precision Reports. Precision Reports are
developed using SQL Report Designer to allow for precise layouts, such as for
invoices or checks.
When reports in Microsoft Dynamics AX 2012 are modified, changes are stored
in the development layer in the MorphX development environment that the
developer is logged into. A copy of the reporting project is created and opened in
Microsoft Visual Studio where it can be edited and then imported back into the
AOT in the layer that the developer is currently working in. Before making
changes to a report, make sure that you are working in the correct development
layer.
2-17
Reporting in Microsoft Dynamics AX 2012
1. In the AOT, open Visual Studio Projects and then open Microsoft
Dynamics AX Model Projects.
2. Find the project that contains the report to edit, right-click the project
and then click Edit. This opens the project in Visual Studio.
3. In the project in Visual Studio, use the Solution Explorer to find the
report to edit. Double-click the report to open the report in Model
Editor.
4. Use the Model Editor to make changes to the report data, parameters
or design.
5. To preview the report changes, expand the Designs node for the
report.
6. Right-click the design that you want to preview, and then click
Preview.
After the report is modified in Visual Studio, the report project can be imported
back into Microsoft Dynamics AX 2012. Follow the procedure that is described
in the "Integrate SSRS with Microsoft Dynamics AX 2012" lesson of this manual
to import a Report Project into Microsoft Dynamics AX 2012.
2-18
Chapter 2: SQL Server Reporting Services
Deploy Reports
After a report is developed in Visual Studio, it must be deployed to the SQL
Reporting Server to be used. Reports can be deployed from Visual Studio, from
the AOT, or by using Windows PowerShell. When a report is deployed, the
following occurs:
2-19
Reporting in Microsoft Dynamics AX 2012
2-20
Chapter 2: SQL Server Reporting Services
2-21
Reporting in Microsoft Dynamics AX 2012
When the Role Center is displayed as the Home page in the Microsoft Dynamics
AX client, the user can make personal modifications to the role center for their
own use only. To do that, the user clicks "Personalize this page". This displays
the SharePoint personal version of the page. In the Infolog Web Part, a message
informs the user that "You are editing the Personal Version of this page". The
user can click "Add a Web Part" to add a new report web part to any region of
the page.
When the Role Center is displayed in the Enterprise Portal, an administrator can
click "Site Actions" and select "Edit Page". This displays the SharePoint shared
version of the page. The Administrator can click "Add a Web Part" to add a new
report web part to any region of the page.
In both cases, there is a region displayed that is labeled "Categories" that contains
a link to the "Microsoft Dynamics AX" web parts. When that link is selected, the
adjacent "Web Parts" region, displays all the options available. Use the right
arrow to scroll down through the list to find the Report web part. In the "About
the Web Part" region, the drop-down list labeled "Add Web Part to:" allows the
user to select the region of the page. Click the Add button.
The following step show how to choose the specific report to display for the web
part:
2-22
Chapter 2: SQL Server Reporting Services
Batch Integration
Reports can be printed using a batch job to print on a recurring schedule, or to
print during off hours.
1. Click the menu item for the report that you want to print.
2. Enter parameters in the print dialog form.
3. Click the Destinations button to display the Print destination
settings form.
4. Select a print destination.
5. Click the Batch tab.
6. Select the Batch processing check box.
7. Enter a task description.
8. Select the batch group that this batch job will be a part of.
9. Click Recurrence to display the Recurrence form. Specify how
often you want the report to be printed. Then click OK to close the
Recurrence form.
10. Click Alerts. Specify how and when you want to receive alerts for
the batch job. Click OK to close the form.
11. Click OK to print the report to the selected destination on a recurring
basis.
2-23
Reporting in Microsoft Dynamics AX 2012
Scenario
Challenge Yourself!
Use the provided information to create a query bound report that exposes
Customer Transaction data.
2-24
Chapter 2: SQL Server Reporting Services
10. Select and drag the following fields from the Fields node under
CustTrans table to the Field node under CustTrans_1 data source:
o AccountNum
o AmountMST
o TransDate
o TransType
o Txt
2-25
Reporting in Microsoft Dynamics AX 2012
2-26
Chapter 2: SQL Server Reporting Services
15. In Model Editor, select the CustTransListDS node and drag it onto
the Designs node. An auto design named AutoDesign1 is created for
the report.
2-27
Reporting in Microsoft Dynamics AX 2012
1. In Model Editor, expand the AutoDesign1 node, and then select the
Sorting node under the CustTransListTable data region.
2. Right-click the Sorting node and then click Add Sort.
3. Type AccountNum as the name.
4. In the Properties window, set the Sort By property to
=Fields!AccountNum.Value.
5. Save the report.
6. In Model Editor, expand the AutoDesign1 node, and then select the
AccountNum field under the Data node.
7. In the Properties window, set the Interactive sorting property to
"True". Repeat this step for the AmountMST, TransDate, and
TransType1 columns.
8. Save the report.
2-28
Chapter 2: SQL Server Reporting Services
5. Right-click the Group on node, and then click Add Group on.
6. Type "AccountNum" as the name.
7. In the Properties window, set the Expression property to
"=Fields!AccountNum.Value".
8. In Model Editor, expand the AutoDesign1 node, and then select the
AccountNum field under the Data region.
9. Right-click the Group1 node and then click Properties.
10. In the Properties window, expand the Instance Aggregates, and set
Render Location to "GroupFooter".
11. Select the AmountMST field under the Data node.
12. In the Properties window, expand the Aggregation item, and set
Aggregate Function to "Sum".
2-29
Reporting in Microsoft Dynamics AX 2012
2-30
Chapter 2: SQL Server Reporting Services
9. In Model Editor, right-click the Datasets node, and then click Add
Dataset.
10. Type "CustomersDS" as the name.
11. Select the node for the dataset.
12. In the Properties window, set the following properties.
o Data Source: Dynamics AX
o Data Source Type: Query
o Default Layout: Table
o Name: CustomersDS
o Query: Select * from CustTable_W1
2-31
Reporting in Microsoft Dynamics AX 2012
2-32
Chapter 2: SQL Server Reporting Services
Scenario
Develop a report to display customer data with parameters for account number,
account statement and whether to include tax.
Challenge Yourself!
Use the information that is provided in the scenario to develop the report.
2-33
Reporting in Microsoft Dynamics AX 2012
8. In the second AOT, expand the Data Dictionary node, expand the
Extended Data Types node, and drag the following types to the
Fields node in the first AOT window:
o AccountNum
o CustName
o LogisticsAddressing
o CustGroupID
o Phone
o CustInvoiceAccount
o Action Days
o InclTax
9. In the second AOT window, expand the Base Enums node and drag
the CustAccountStatement enumeration to the Fields node of the first
AOT window.
1. In the AOT, right-click the Classes node, and then click New Class.
2. Right-click the new class, click Rename, and then enter
"SrsRDPSampleClass".
3. Expand SrsRDPSampleClass, right-click classDeclaration, and then
click View Code.
4. In the code editor, edit the class so that it contains the following
code.
[
SRSReportQueryAttribute (querystr(Cust)),
SRSReportParameterAttribute(classstr(SrsRDPContractSample))
]
public class SrsRdpSampleClass extends
SRSReportDataProviderBase
{
TmpCustTableSample tmpCust;
}
5. Save the class and close the editor.
1. In the AOT, right-click the Classes node, and then select New Class.
2. Right-click the new class, click Rename, and then enter
"SrsRDPContractSample".
3. Expand SrsRDPContractSample, right-click classDeclaration, and
then click View Code.
2-34
Chapter 2: SQL Server Reporting Services
[DataContractAttribute]
public class SrsRDPContractSample
{
AccountNum accountNum;
CustAccountStatement accountStmt;
Boolean inclTax;
}
5. Save the class and close the editor.
[DataMemberAttribute("AccountNum")]
public AccountNum parmAccountNum(AccountNum _accountNum
= accountNum)
{
accountNum = _accountNum;
return accountNum;
}
3. Save the method and close the editor.
4. Right-click SrsRDPContractSample, point to New, and then click
Method.
5. Edit the method so that it contains the following code.
[DataMemberAttribute("CustAccountStatement")]
public CustAccountStatement
parmAccountStmt(CustAccountStatement _accountStmt =
accountStmt)
{
accountStmt = _accountStmt;
return accountStmt;
}
6. Save the method and close the editor.
7. Right-click SrsRDPContractSample, point to New, and then click
Method.
2-35
Reporting in Microsoft Dynamics AX 2012
[DataMemberAttribute("InclTax")]
public boolean parmInclTax(boolean _inclTax = inclTax)
{
inclTax = _inclTax;
return inclTax;
}
9. Save the method and close the editor.
[SRSReportDataSetAttribute("TmpCust")]
public TmpCustTableSample getTmpCustTable()
{
select * from tmpCust;
return tmpCust;
}
3. Save the method and close the editor.
2-36
Chapter 2: SQL Server Reporting Services
2-37
Reporting in Microsoft Dynamics AX 2012
This setting is for dynamic parameters on the report. Setting the property to True
allows you to filter the report by setting a range on any fields from the data
source table.
6. For the Query property, click the ellipsis button (). A dialog box
displays where you can select an RDP class that is defined in the
AOT and identify the fields that you want to use. Select the
SrsRDPSampleClass class and click Next. In the Select Fields
dialog box, keep all the check boxes selected, and then click OK.
7. In Model Editor, select the Customer node and drag it onto the
Designs node. An auto design named AutoDesign1 is created for the
report. Based on what you select, the Query property value is
updated. In this case, the query is SELECT * FROM
SrsRDPSampleClass.TmpCust.
2-38
Chapter 2: SQL Server Reporting Services
Summary
Reports in Microsoft Dynamics AX 2012 are developed using SQL Server
Reporting Services and Visual Studio instead of X++. The move to SSRS puts
Microsoft Dynamics AX reports on Microsoft's preferred reporting platform
providing users professional-looking reports, more export formats, and a more
capable report designer.
2-39
Reporting in Microsoft Dynamics AX 2012
3. True or False. The new Report Data Provider classes let you build reports
that use data from an X++ class as the source.
( ) True
( ) False
4. What are some advantages of the new SSRS reporting architecture over X++
reports? (Select all that apply)
( ) Professional-looking reports
( ) More flexible architecture
( ) More supported export formats
( ) Better report designer
5. What are some options for upgrading existing Microsoft Dynamics AX 2009
SQL Server Reporting Services (SSRS) reports?
( ) Rewrite the SSRS report using the X++ reporting framework
( ) Do not upgrade the reports. Use a SQL Server Reporting Services
template and customize it to meet your needs.
( ) Deploy the SSRS report using the deployment wizard.
( ) Use the Report Upgrade Tool to upgrade the reports so that they are
compatible with the Microsoft Dynamics AX 2012 schema.
2-40
Chapter 2: SQL Server Reporting Services
1.
2.
3.
2-41
Reporting in Microsoft Dynamics AX 2012
Solutions
Test Your Knowledge
1. True or False. Reports are not fully-integrated into the Microsoft Dynamics
AX security system.
( ) True
() False
3. True or False. The new Report Data Provider classes let you build reports
that use data from an X++ class as the source.
() True
( ) False
4. What are some advantages of the new SSRS reporting architecture over X++
reports? (Select all that apply)
() Professional-looking reports
() More flexible architecture
() More supported export formats
() Better report designer
5. What are some options for upgrading existing Microsoft Dynamics AX 2009
SQL Server Reporting Services (SSRS) reports?
( ) Rewrite the SSRS report using the X++ reporting framework
() Do not upgrade the reports. Use a SQL Server Reporting Services
template and customize it to meet your needs.
( ) Deploy the SSRS report using the deployment wizard.
( ) Use the Report Upgrade Tool to upgrade the reports so that they are
compatible with the Microsoft Dynamics AX 2012 schema.
2-42