This is follow-up to post from a few days ago (Dynamics AX 2009: SSRS Reports and the role of Business Logic & Data Methods). In the last post, we created a very basic report using DataMethods.
Some things to note about that report
- There are two kinds of report designs: “Auto Designs” and “Precision Designs”
- The report we created was an “Auto Design” which for standard “list & charts of data” reports is the fastest way to get an SSRS report in Dynamics AX
Now let’s take a look at the way the report looked by looking at the preview
And remember that the reason that it looks unimpressive right now is that there are no layout and style templates attached.
BACKGROUND ON AUTO DESIGN TEMPLATES
Templates control how Auto design reports look and how they are arranged on the page.
Their intended use of these templates is reports can share the same templates – thus you can keep all your autodesign reports looking consistent.
FIND THE PRE-BUILT TEMPLATES
Let’s make these reports look better. Dynamics AX comes with some pre-built templates so we’ll start by using them.
First we need to “get” them by walkthrough these steps (http://msdn.microsoft.com/en-us/library/cc576854.aspx) …
Select File > Add > Existing Project from Dynamics AX
The Add Existing Project from Dynamcis AX dialog will appear
In this list select “SharedLibrary” and click OK
And then you’ll see a new project in the solution
A close-up view …
USING THE PRE-BUILT TEMPLATES
In the report project, right-click on DemoDataMehod1 > References and select Add Reference.
NOTE: do NOT add this reference to the DemoDataMehod1 > BusinessLogic > References node – the reference can be added but you won’t be able to select it in the report design.
The Add Reference dialog will appear (this is slightly different from the normal Visual Studio Add reference dialog)
“SharedLibrary” now appears in the list at the bottom.Click OK
And you can now see the reference has been added
Select Model View to get back to the report model
You can see that “Shared Library” is in the model also
A close-up view …
Now click on the report design
And in the properties window you’ll see LayoutTemplate – we’ll associate this with one of the templates in SharedLibrary
Click the field to see the possible choices
Now select the Table
And look at its properties
Click on Style Template and select “TableStyleTemplate”
Now we’ve associated a layout style the entire report and a style for the table. Let’s preview.
As you can see the report looks much better.
BEFORE VERSUS AFTER
Just so that it’s totally clear, let’s put the original report we started with next to the how it appears now.
- The fonts have changed
- There is a header for the report
- the name of the report design is seen as the title of the report.
- The company name is present
- There’s info on the page number and when the report was generated
- A horizontal line separates the header from the body of the report
WHAT KINDS OF TEMPLATES EXIST?
The simplest way to see them is to try to add one.
Right-click on the report project and select Add > New Item
A dialog will appear
Looking into it you’ll see several kinds of items
And of these you’ll see six kinds of templates
A FEW MORE TWEAKS
Now that we see that the design name is being used, let’s give it a better name.
We could try to rename the AutoDesign1 node to something else – but this is an “identifier” in the code so we can’t put in a string with spaces.
So instead of renaming the Design, we’ll change it’s properties
Right click on the design and select Properties
And in the properties window we’ll change the Title to something descriptive
Enter “Names and Ages”
And you’ll see that the preview reflects this change
We are still left with “Dataset1” as the name of the table, by setting the properties in this report element we can fix that also
Which gives us this in the preview …