MicroStrategy ONE

Creating a Custom Event for Grid Manipulations

There may be instances in which you want a custom action to be performed. For example, you might want to place a custom button on a MicroStrategy Web page, which triggers a custom grid manipulation when it is clicked. To accomplish this, you need to create a custom event that causes the custom action to be performed.

In this customization scenario, you create a new event which allows a user to move all template units from the rows axis of a cross-tabbed report to the columns, resulting in a tabular report. You place a link associated with this new event— called "Make tabular!" in this scenario— on the bottom of the Report Execution page so that a user can execute the associated functionality with a single click.

This particular action is part of the out-of-the-box MicroStrategy Web functionality, but it provides a good example of how to create a new event to achieve a result such as this. To add other custom actions that are not included out-of-the-box, simply extrapolate from the instructions and code samples in this scenario.

Before customization:

After customization:

This customization can be accomplished using either of the following methods:

Deploying the plug-in provided with MicroStrategy SDK

MicroStrategy SDK provides a plug-in (ZIP file) that can simply be extracted to thepluginsfolder to view the customization in MicroStrategy Web. The following steps guide you in locating the plug-in and deploying it. 

  1. Access the plug-in: JSP version or ASP .NET version

  2. Extract the plug-in to the plugins subfolder inside the MicroStrategy Web installation folder.

  3. Launch MicroStrategy Web to view the customization.

Using the Web Customization Editor to create a plug-in

MicroStrategy SDK provides a Web Customization Editor that can be used to create a customization plug-in. The following steps guide you in creating the plug-in and deploying it.

  1. Launch the Web Customization Editor.

  2. Click on MicroStrategy Web Configuration inside the Application Settings view to expand the hierarchical tree. The expanded list comprises the different settings that can be modified to perform customizations. 

  3. Click on Pages to expand the list of pages used in MicroStrategy Web.

  4. Double-click the report(Report Execution) page to edit it.

  5. Click the Template Properties tab at the bottom in the right frame to make changes to the Default page template. 

  6. Right-click the content page-section and select Edit current file.

  7. Click the Yes button in the prompt to edit the Report_Content page section file.

  8. In the code that is displayed for Report_Content, add the code shown below at the end of the existing code. This new code adds a link (identified by the test "Make tabular!") that triggers the new custom event.

    J2EE environment::

    Copy
    <web:urlEvent eventID="com.microstrategy.sdk.samples.events.EnumCustomReportHandlerForRowToColsOnlyEvents.BEAN_EVENT_MOVEALLATTSTOCOLUMN" baseBean="rb">Make tabular!</web:urlEvent>

    .NET environment

    Copy
    <web:urlEvent runat="server" eventID="com.microstrategy.sdk.samples.events.EnumCustomReportHandlerForRowToColsOnlyEvents.BEAN_EVENT_MOVEALLATTSTOCOLUMN" baseBean="rb">Make tabular!</web:urlEvent>
  1. Expand the report(Report Execution) page.

  2. Expand Beans.

  3. Expand frame (Type=ReportFrameBean).

  4. Right-click rb (Type=ReportBean) and select New Event Handler.

  5. On the Custom Event Handler Creation Wizard, browse to the source folder and click OK.

  6. Enter com.microstrategy.sdk.samples.events as the package name.

  7. Enter CustomReportHandlerForRowToColsOnly as the Name of the event handler.

  8. With the Create New Event radio button selected, enter 4501 as the Event ID and MOVEALLATTSTOCOLUMN as the Event Name

  9. Click Next.

  10. Click Finish.

  11. EnumCustomReportHandlerForRowToColsOnlyEvents.java opens in the editor. It contains the definition of your new event.

    Copy
    int  BEAN_EVENT_MOVEALLATTSTOCOLUMN = 4501; 
  12. Click the CustomReportHandlerForRowToColsOnly.java tab and it opens in the editor. The sample, CustomReportHandlerForRowToColsOnly.java, contains the entire code for this custom event handler. Copy the sample code and paste it over the newly created CustomReportHandlerForRowToColsOnly.java in the editor. 

  13. Save your changes.

  14. Launch MicroStrategy Web to view the customization.

See Also