Dynamics AX
  RSS Feed  LinkedIn  Twitter
Want to turn you're data into a true asset? Ready to break free from the report factory?
Ready to gain true insights that are action focused for truly data informed decisions?
Want to do all of this across mutliple companies, instances of Dynamics and your other investments?
Hillstar Business Intelligence is the answer then! (www.HillstarBI.com)

Hillstar Business Intelligence for Microsoft Dynamics AX and NAV on Mobile, Desktop, Tablet

Let us prove to you how we can take the complexity out of the schema and truly enable users to answer the needed questions to run your business! Visit Hillstar Business Solutions at: www.HillstarBI.com

Saturday, July 18, 2009

Dynamics AX 2009 - Calling X++ logic from SSRS and C#

Recently I wrote the following blog entry:
Calling a Custom Dynamics AX 2009 SSRS report and passing parameters - From X++

This was to address a set of questions from a reader, where he stated it was not clear about how to call a report from X++ and send in parameter data. The above post, shows you exactly how to do that.

This is the blog entry, in which those comments where left.:
Dynamics AX 2009 - Reporting Possibilites

The next thing in the readers comments, was making use of display methods, or methods in general from X++. This also can be done, an there is great examples of this through some of the out of the box Report's, and also the new Environmental Dashboard that came out during the spring.

I am going to pull from the environmental dashboard, and show an example of this being used.

So if we open our reports project, we will see something similar as follows, and notice the report, has a section for data methods.

Looking at these data methods that are part of the EnergyCost report, we see we have this one, with some parameters / variables that need to be sent in.

On double clicking of the method, takes us to the Business Logic section, and we see our C# code here, along with the .Net Business Connector Assembly, and AxaptaWrapper Object being used.

As you can see we have access to make calls to static methods, and normal non-static business logic. So this could easily be changed and made use of as a template for working with X++ methods, that we need access to for our report purposes.

Now moving back to the report design, I have highlighted the field in the report design, which happens to be a Matrix Cell, that makes use of this datamethod. The expression where this data method is called, is the following.:

=Cdbl(GetEnergyCost(Fields!SourceProcessId.Value, Fields!DestinationProcessId.Value, Fields!SubstanceId.Value, Parameters!EnergyCost_Filter.Value))

So we can see our datamethod being called, to fill this field, and see how the parameters are being sent in. Even one being referenced from the parameters that are sent in to this report.

This is a really good example, that can be expanded upon, and used as a template for such custom needs of datamethods, and access X++ business logic and display methods for a Dynamics AX 2009 SSRS Report.

I hope this helps, and look for more soon. See you next time!

Visit Hillstar Business Intelligence (www.HillstarBI.com) in order to truly unlock your data trapped in your Microsoft Dynamics investment. With our value driven business intelligence strategy Hillstar help you transform into a data informed company.

"Visit the Dynamics AX Community Page today!"

Labels: , , , , , , , ,


Anonymous Nathan said...

This really demonstrates the power of AX 2009. If any of you have been lucky enough to develop back from 2.5 through 4.0 you'll know that not until 2009 would this kind of functionality been present in such an easy way.


8:54 PM  
Blogger Phil772 said...

This AX call FAILS when the report runs as a SSRS subscription.

How can that be resolved???

6:48 AM  
Anonymous Anonymous said...

Nathan - In my opinion this is a step backwards, at least from a developer's perspective. Even back in 2.5, if I wanted to use predefined business logic (ie a display method), then I drag and drop it directly onto the report design. All labels and security would be automatic. Oh, and I wouldn't have to redeploy the reports which can be an issue with sites that don't have the correct tools on-hand at the time.
And I've been publishing reports on-line since 2.5, you just export to PDF then send the binary response to the server.

8:39 AM  
Anonymous Nathan said...

I would agree that if you were creating an AX report, it was very easy to reference a display method on a report design. What I feel this is starting to demonstrate and if you take it a step further by utilizing SSRS you can get to the point of eliminating the need to do reporting off of the OLTP AX database and in a reporting OLAP data warehouse and still use the business logic within AX. Of course there are other ways of doing this still (CLR for one) but this is a good example of the start of the next step possibilities of reporting with AX.

9:14 AM  
Blogger sjafry said...

I am getting this error when build the solution.
The data method 'xxxxx' is present in the model but not in the business logic assembly.

Can you please help resolving this issue. I am using Dynamics AX 2009 and VS 2008

6:38 AM  

Post a Comment

Links to this post:

Create a Link

<< Home

Copyright 2005-2011, J. Brandon George - All rights Reserved