embedding powerview dashboards within dynamics ax forms walkthrough

14
© 2013 Murray Fife. All rights reserved. Embedding PowerView Dashboards within Dynamics AX Forms PowerView is a great tool for creating dashboards and analytics for Dynamics AX, and you can easily embed it into Role Centers to create summary dashboards, and you can use it to drill into offending statistics that you notice, and you can easily create new dashboards using the new Analyze button in Dynamics AX 2012 R2. But what would be even better would be having context sensitive dashboards built into the actual master data forms. Then you would be able to see statistics and trends against the data that you a focused on. Fortunately that is not very hard to do. In this worked example we will show how you can easily create a new dashboard through PowerView and then embed it within the Dynamics AX forms to show you just the statistics that you are looking for. Creating a Customer Summary Dashboard The first step in the process is to create a new PowerView Dashboard that you will embed into your master forms. Once you have done this, you can continue to tweak the view later on and not have to do any further coding. HOW TO DO IT... To build a simple customer analysis dashboard, follow these steps:

Upload: murray-fife

Post on 27-Jul-2015

548 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Embedding PowerView Dashboards within Dynamics AX Forms Walkthrough

© 2013 Murray Fife. All rights reserved.

Embedding PowerView

Dashboards within

Dynamics AX Forms PowerView is a great tool for creating dashboards and analytics for Dynamics AX, and you can easily

embed it into Role Centers to create summary dashboards, and you can use it to drill into offending

statistics that you notice, and you can easily create new dashboards using the new Analyze button in

Dynamics AX 2012 R2. But what would be even better would be having context sensitive dashboards

built into the actual master data forms. Then you would be able to see statistics and trends against the

data that you a focused on. Fortunately that is not very hard to do.

In this worked example we will show how you can easily create a new dashboard through PowerView

and then embed it within the Dynamics AX forms to show you just the statistics that you are looking for.

Creating a Customer Summary Dashboard

The first step in the process is to create a new PowerView Dashboard that you will embed into your

master forms. Once you have done this, you can continue to tweak the view later on and not have to do

any further coding.

HOW TO DO IT...

To build a simple customer analysis dashboard, follow these steps:

Page 2: Embedding PowerView Dashboards within Dynamics AX Forms Walkthrough

Embedding PowerView Dashboards Within Dynamics AX Forms

© 2013 Murray Fife. All rights reserved.

1. Start off by finding your PowerView Data Sources, and creating a new reporting canvas. In this

example we will us the Sales cube as our data source.

2. Build your dashboard from the available dimensions and measures in the cube. Here we just

summarized the sales by date period, and also listed out all of the products that the customers

have bought.

Page 3: Embedding PowerView Dashboards within Dynamics AX Forms Walkthrough

Embedding PowerView Dashboards Within Dynamics AX Forms

© 2013 Murray Fife. All rights reserved.

Note: Don’t put any filters on this form. We will apply filters in the code later on.

3. Once you have finished building the dashboard, select the Save As option from the File menu.

When the Save As dialog box shows up, give your new dashboard a name and then click the

Save button.

Page 4: Embedding PowerView Dashboards within Dynamics AX Forms Walkthrough

Embedding PowerView Dashboards Within Dynamics AX Forms

© 2013 Murray Fife. All rights reserved.

HOW IT WORKS...

Now if you return to the PowerView reports library you will see the new report that you just created.

If you open it then you will see your report in view mode.

Page 5: Embedding PowerView Dashboards within Dynamics AX Forms Walkthrough

Embedding PowerView Dashboards Within Dynamics AX Forms

© 2013 Murray Fife. All rights reserved.

Embedding the Dashboard into the Customer

Form

Once you have designed your dashboard, it is time to add it to your forms. This will allow you to browse

through the records, and see statistics alongside the original field data in Dynamics AX.

GETTING READY

In this example we will extend out the CustTable form, which normally looks like this.

HOW TO DO IT...

To add the PowerView dashboard to a form in Dynamics AX, follow these steps:

Page 6: Embedding PowerView Dashboards within Dynamics AX Forms Walkthrough

Embedding PowerView Dashboards Within Dynamics AX Forms

© 2013 Murray Fife. All rights reserved.

1. To do this, open up the AOT, and create a new project for the change. Then copy the CustTable

form over to the new project.

Page 7: Embedding PowerView Dashboards within Dynamics AX Forms Walkthrough

Embedding PowerView Dashboards Within Dynamics AX Forms

© 2013 Murray Fife. All rights reserved.

2. Expand the form definition until you are able to access all of UpperGroup set of controls which

houses the definition for the main form layout.

3. Right-mouse click on the UpperGroup form and from the New Control sub menu, select the

Group item. Rename the group, and then set the Width to 600, and the Height to 512. We do

this so that you can see the dashboard when it is displayed on the form – the default sizing for

Page 8: Embedding PowerView Dashboards within Dynamics AX Forms Walkthrough

Embedding PowerView Dashboards Within Dynamics AX Forms

© 2013 Murray Fife. All rights reserved.

the control is a little narrow.

4. Then right-mouse-click on the new group that you added and select the ActiveX option from the

New Control sub menu. When the ActiveX browser is displayed, find the Microsoft Web

Browser control and add it to the group.

Page 9: Embedding PowerView Dashboards within Dynamics AX Forms Walkthrough

Embedding PowerView Dashboards Within Dynamics AX Forms

© 2013 Murray Fife. All rights reserved.

5. Give your new ActiveX control a more appropriate name, and also set the Width to Column

Width, and the Height to Column Height so that it fills the container.

6. Now open up the Methods at the parent table level, and right-mouse-click on the Methods

group. Open up the Override method sub-menu and select the activate method. When the

method editor opens up, add the following lines of code.

Note: In the second line of the url variable definition, note the name of the report. This needs

to match the name of the report that you created in the prior section.

If you save the project and then open up the customer form, you will see the PowerView

Page 10: Embedding PowerView Dashboards within Dynamics AX Forms Walkthrough

Embedding PowerView Dashboards Within Dynamics AX Forms

© 2013 Murray Fife. All rights reserved.

dashboard is now shown.

7. Unfortunately this allows the user to edit the form. To fix that, update the code to include a

couple more qualifiers.

Page 11: Embedding PowerView Dashboards within Dynamics AX Forms Walkthrough

Embedding PowerView Dashboards Within Dynamics AX Forms

© 2013 Murray Fife. All rights reserved.

Now when you open up the form, you will just see the report.

8. The final step in the process it to add some filters to the code so that it will only show the data

that you selected.

Page 12: Embedding PowerView Dashboards within Dynamics AX Forms Walkthrough

Embedding PowerView Dashboards Within Dynamics AX Forms

© 2013 Murray Fife. All rights reserved.

Here is the complete code listing:

HOW IT WORKS...

Now when the dashboard is displayed, it will only show the information that relates to the current

record.

How cool is that!

public void activate(boolean _active) { str url; url = "http://dynamicsax.contoso.com/sites/DynamicsAx/_layouts/ReportServer/AdHocReportDesigner.aspx"; url = url + "?RelativeReportUrl=/sites/DynamicsAx/Power View Reports/CustomerSummaryDashboard.rdlx"; url = url + "&ViewMode=Presentation"; url = url + "&DefaultItemOpen=1"; url = url + "&Fit=True"; url = url + "&BackgroundColor=White"; url = url + "&AllowEditViewMode=False"; url = url + "&PreviewBar=False"; url = url + "&rf=[Company].[Company] eq '" + CustTable.dataAreaId + "'"; url = url + "&rf=[Customer].[Customer] eq '" + CustTable.AccountNum + "'"; PowerView.Navigate(url); super(_active); }

Page 13: Embedding PowerView Dashboards within Dynamics AX Forms Walkthrough

Embedding PowerView Dashboards Within Dynamics AX Forms

© 2013 Murray Fife. All rights reserved.

Summary

This was just a quick example of how you could create a PowerView report and then embed it into the

Dynamics AX forms.

This is not the only place that you could do this though. If you wanted, you could create dashboards for:

Inventory statistics and embed it within the products forms

Vendor scorecards, and include them in the vendor records to help with negotiations

Project status reports to help the project managers.

Employee performance

This is a simple change to make, so give it a go.

Page 14: Embedding PowerView Dashboards within Dynamics AX Forms Walkthrough

About Me I am a Microsoft Dynamics AX MVP, a

Presenter, an Author, and Solution

Architect at I.B.I.S. Inc with over 18 years

of experience in the software industry.

Like most people I have paid my dues as a

developer, as an implementation

consultant, and a trainer. I have a hard to

find blend of technical and interpersonal skills and now spend my

days working with companies solving their problems with the

Microsoft suite of products, specializing in the Dynamics® AX

solutions.

Unable to completely kick the habit of being a developer,

countless prototypes have started their life on my desktop, only

to be turned into standard products and offerings. The projects

that are too visionary (a.k.a. too out there) usually live on through

my personal blog site (A Tinkerers Notebook -

http://www.atinkerersnotebook.com) or my SlideShare account

(http://www.slideshare.net/murrayfife/presentations) waiting for

others discover them.

EMAIL: [email protected]

PHONE: +1 (770) 324-3862

TWITTER: @murrayfife

WEB : http://murrayfife.me

BLOG: http://atinkerersnotebook.com/

SLIDESHARE: http://slideshare.net/murrayfife/presentations

LINKEDIN: http://www.linkedin.com/in/murrayfife

© 2013 Murray Fife. All rights reserved.

The information herein is for informational purposes only and

represents the current view of Murray Fife as of the date of this

presentation. Because Murray Fife must respond to changing

market conditions, it should not be interpreted to be a

commitment on the part of Junction Solutions, and Murray Fife

cannot guarantee the accuracy of any information provided after

the date of this presentation.

MURRAY FIFE MAKES NO WARRANTIES, EXPRESS, IMPLIED OR

STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.