Walkthrough: Creating an Analyze Data Button on a List Page

Important

This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2

You can use Power View to create interactive ad-hoc reports in Microsoft Dynamics AX. Several list pages have an Analyze data button that launches a Power View report designer. The Power View report designer connects to an Analysis Cube and allows you to drag and drop fields for quick analysis. This topic describes how to add an Analyze data button to additional list pages.

To add an Analyze data button to a list page, you must:

  • Create a data source that connects your Power View report to a cube.

  • Create a class that gets the URL of the Power View report designer.

  • Create a menu item that specifies the class you created.

  • Create a button that points to the menu item you created.

Prerequisites

  • Microsoft SharePoint Server 2010 or 2013 must be installed.

  • Microsoft SQL Server Reporting Services 2012 Service Pack 1 must be installed in SharePoint integrated mode with cumulative update 4 applied.

  • The Power View site collection feature in SharePoint must be activated. For instructions about how to activate this feature, see the information in the Install Reporting Services SharePoint Mode as a Single Server Farm topic.

  • Microsoft SQL Server Analysis Services 2012 Service Pack 1 must be installed in multidimensional mode with cumulative update 4 applied.

  • Microsoft Dynamics AX 2012 R2 must be installed. The following components are required:

  • Cumulative update 6 for Microsoft Dynamics AX 2012 R2 must be installed. For more information about how to install cumulative update 6 for Microsoft Dynamics AX 2012 R2, see the Knowledge Base article for cumulative update 6.

    After you install cumulative update 6, you must redeploy three page definitions. To deploy these page definitions, complete the following steps. Keep in mind, when you redeploy the Role Center pages, you will lose customizations made to the pages.

    1. Open the AOT.

    2. Expand the Web > Web Files > Page Definitions node.

    3. Right-click RoleCenterCFOPV and click Deploy Element.

    4. Right-click RoleCenterTreasurerPV and click Deploy Element.

    5. Right-click PowerViewDataSourceGeneratorPV and click Deploy Elements.

Creating a Data Source

You must add a data source to your SharePoint library to connect a Power View report designer to a cube.

To create a data source

  1. Open your browser and go to the Enterprise Portal site. The URL for the Enterprise Portal site is typically http://[SharePointServerName]/sites/DynamicsAX.

    Note

    For security reasons, integrating Power View with Microsoft Dynamics AX is not supported in environments where the Enterprise Portal site is configured for multiple data partitions.

  2. Go to the Power View Reports folder. The URL for this folder is typically http://[SharePointServerName]/sites/DynamicsAX/Power%20View%20Reports.

  3. Click Documents > New Document > Report Data Source. The Data Source Properties page is displayed.

  4. In the Name field, enter a name for the data source. For example, if the data source will connect to the Retail cube, you may want to name the data source Retail cube.

  5. In the Data Source Type area, select Microsoft BI Semantic Model for Power View.

  6. In the Connection string area, enter the following connection string:

    Provider=MSOLAP.4;Integrated Security=SSPI;Persist Security Info=True;Data Source=[ServerName];Initial Catalog=[DatabaseName];Locale identifier=[LocaleID];Cube=[CubeName]

    The following table lists the documentation conventions that are used in the connection string.

    Value

    Description

    [ServerName]

    The name of the server on which Analysis Services is installed.

    [DatabaseName]

    The name of the Analysis Services database that contains the cube that you want to connect to.

    [LocaleID]

    The identifier that designates the language of the labels to display on the report. For example, if you want measures and dimensions to be shown in German, you must add German translations to the cube and specify the locale identifier for German.

    For more information about how to add translations to a cube, see Update an Existing SQL Server Analysis Services Project. For a list of the locales that are supported by both Enterprise Portal and SharePoint, see Install Enterprise Portal on a single server.

    [CubeName]

    The name of the cube that contains the data that you want to display on the report.

    For example, if you want to connect to the Retail cube that is provided with Microsoft Dynamics AX, the default connection string is:

    Provider=MSOLAP.4;Integrated Security=SSPI;Persist Security Info=True;Data Source=[ServerName];Initial Catalog=Dynamics AX initial;Locale identifier=1033;Cube=Retail cube

  7. In the Credentials area, select Windows authentication (integrated) or SharePoint user.

    Note

    If Analysis Services and Enterprise Portal are installed on different computers, you must use Kerberos security. To configure Kerberos security, see this white paper. After you have configured Kerberos security to work with the servers, complete the following steps:

    1. In the Credentials area, select Stored credentials.

    2. Enter the user name and the password for the account that is assigned to the Analysis Services server administrator role. In most cases, this is the Business Connector proxy account. For more information, see the Assign the Business Connector proxy account to the Analysis Services server administer role section in Before you configure Analysis Services.

    3. Select the Use as Windows credentials check box.

    4. Select the Set execution context to this account check box.

  8. Click Test Connection to verify the connection to the cube.

  9. In the Availability area, select the Enable this data source check box.

  10. Click OK. The data source is created.

Creating a Class

You need a class that uses the Power View integration framework to get the URL of a Power View report designer with a cube. The PowerViewReporting class generalizes this implementation and fulfills specific error handling requirements. If you use the PowerViewReporting class, be aware that the data source name and cube name must be an exact match, and you must pass the name of the cube as the first parameter on the action menu item in the next section. The following procedure demonstrates how to create your own class called MyPVClass.

To create a class

  1. In the AOT, right-click Classes, and then click New Class. Name the class MyPVClass. For more information about classes, see Classes in X++.

  2. Right-click the class you created, point to New, and then click Method.

  3. In Code Editor, add code for method1 to name the method main and to get the URL of the Power View designer for the cube. The following code example shows how to verify that Power View is available and how to get the URL of the data source:

    public static void main(Args args)
    {
            if (SrsReportHelper::isPowerViewModelDeployed('Accounts receivable cube'))
        {
            infolog.urlLookup(SrsReportHelper::getPowerViewDataSourceUrlClient('Accounts receivable cube'));
        }
        else
        {
           // Cube has not been deployed – display error message
        }
    
    }
    

Creating a Menu Item

After you create the class, you create a menu item that references that class. The class indicates the cube the Power View report designer connects to. If you use the existing PowerViewReporting class, you must specify the cube the Power View report designer connects to in the Parameters property.

To create a menu item

  1. In the AOT, right-click AOT > Menu Items > Action, and then click New Menu Item.

  2. Right-click the new menu item and then click Properties.

  3. Set the following properties:

    Property

    Value

    Name

    Specify a name for your menu item. For example, CreatePowerViewReportAccountsReceivableCube.

    Label

    Analyze data

    HelpText

    Provide help text for the button.

    ObjectType

    Class

    Object

    Specify the class you created. For example, MyPVClass. You can also use the PowerViewReporting class if you specify the cube to connect to using the Parameters property.

    Parameters

    If you use the PowerViewReporting class instead of creating your own class, specify the name of the cube to connect the Power View report designer to.

    NormalImage

    12578

    ImageLocation

    EmbeddedResource

Creating a Button

After you create a menu item, you can create a button that points to the menu item. The following procedure demonstrates how to create an Analyze data button to launch a Power View report designer page.

To create a button

  1. In the AOT, navigate to the list page form that you want to add an Analyze Data button to.

  2. Expand Designs > Design > ActionPane > ActionPaneTab, and identify the button group you want to add the button to.

  3. Right-click the button group control, point to New Control, and then click MenuItemButton.

    Note

    To specify the location of the button in the button group, use the ALT+UP ARROW or ALT+DOWN ARROW to position the button before or after an existing button.

  4. Specify the following properties for the new button:

    Property

    Value

    Name

    Specify a name for the button. For example, AnalyzeData.

    Big

    Yes

    MenuItemType

    Action

    MenuItemName

    Specify the menu item you created in the previous section. For example, CreatePowerViewReportAccountsReceivableCube

  5. Add logic to the form load event to hide the button if Power View is not configured. For example, expand the Methods node of the form, and then double-click the init method. Add the following line of code:

    ReportingGroup.visible(SrsReportHelper::isPowerViewConfigured());
    

To view the button, right-click the form name in the AOT, and then click Open. The client displays the button in the list page action pane. To test the button action, click the button.