MicroStrategy ONE

Modifying the Prompt Style for a Specific Report

There may be instances when you want to perform specific behavior dependent on a particular object stored in the metadata. For example, you might want to customize the style of a report or a prompt, dependent on the report that is being executed.

In this customization scenario, you modify the style of a prompt when the Revenue vs. Forecast report is executed so that multiple prompts are displayed from left to right (horizontally)), rather than from top to bottom (vertically). You accomplish this using an add-on that identifies the object ID of the report being executed; checks to see if it matches the report ID specified in the request; if so, checks to see if the report contains prompts; and, if prompts exist, sets the style of the prompt to display in the style specified in the request.

The advantage of using an add-on is that the report ID is checked—and the prompt style is switched if there is a match—each time a page is loaded (because an add-on is executed every time a page is loaded).

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. Create a new plug-in and give it a meaningful name. For example: ModifyingPromptStyleOneReport

  3. Exit the Web Customization Editor. 

  4. Create an XML file, PromptQuestionHorizontalViewRoll.xml. The sample, PromptQuestionHorizontalViewRoll.xml,contains the entire code for this layout definition file. 

  1. Save this custom XML file, PromptQuestionHorizontalViewRoll.xml, in the plugins\pluginName\WEB-INF\xml\layoutsCS\mstr\layouts subfolder inside the MicroStrategy Web installation folder. For example: plugins\ModifyingPromptStyleOneReport\WEB-INF\xml\layoutsCS\mstr\layouts

  2. Copy the layout definition files PromptsContainerLayout_widget.xml (if you wish to view the customization in DHTML mode) and CustomPromptsSampleLayout.xml (if you wish to view the customization in HTML mode). 

  3. Paste the files in your customization plug-in folder.  For example: plugins\ModifyingPromptStyleOneReport\WEB-INF\xml\layouts

  4. Open the copy of PromptsContainerLayout_widget.xml for editing and replace the default plug-in name DefaultPlugin with the name of your customization plug-in."

    Before customization:

    Copy
    <mstrlayout:bSetProperty path="layoutClass" value="@DefaultPlugin:mstr.layouts.PromptQuestionHorizontalViewRoll"/>

    After customization:

    Copy
    <mstrlayout:bSetProperty path="layoutClass" value="@ModifyingPromptStyleOneReport:mstr.layouts.PromptQuestionHorizontalViewRoll"/>
  1. If the Web Customization Editor is closed, launch it again and access your plug-in

  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. Right-click report (Report Execution) and select Create New Add-on. This launches the Add-on Creation wizard. By default, visualizations have prompts disabled for optimizing performance. This add-on removes the flag that disables the prompts for visualizations so prompts are displayed even if the report contains a custom visualization.

  5. Click Browse to select the source folder for the project. 

  6. Enter com.microstrategy.sdk.samples.addons in the Package text field. 

  7. Enter PromptStyleChangerAddon in the Name text field. 

  8. Enter Addon for changing prompt style in the Description text field. 

  9. Click Next

  10. Click Finish. PromptStyleChangerAddon.java opens in the editor. The sample, PromptStyleChangerAddon.java, contains the entire code for this custom add-on. 

  11. Save your changes. 

  12. Double-click report (Report Execution) and click the Add-on Properties tab at the bottom in the right frame. 

  13. With com.microstrategy.sdk.samples.addon.PromptStyleChangerAddOn selected in the Add-ons section, click Add New in the Add-on properties section. 

  14. Select reportID and styleName, and click >>

  15. Click OK

  16. In the Add-on properties section, enter D08450DF4E71E2068B9AE78845C1BA28 as the value for add-on property reportID. This report ID is for Revenue vs. Forecast, a prompted report in Shared Reports->Subject Areas->Sales and Profitability Analysis inside MicroStrategy Tutorial project. You can use the reportID of any prompted report of your choice. 

  17. If you are performing this customization for HTML mode, then in the Add-on properties section, enter PromptsTransformCustom as the value for add-on property styleName

  18. Save your changes. 

  19. Navigate to MicroStrategy Web Configuration->Styles

  20. Right-click Styles and select New Style. This launches the Style Creation Wizard

  21. Enter PromptsContainerCustom_widget in the Name text field if you wish to view the customization in DHTML mode. For HTML mode, enter PromptsTransformCustom

  22. Enter Style: Horizontal Prompts Transform in the Description text field. 

  23. Select PromptsContainerTransform (for DHTML mode) or PromptsClassicTransform (for HTML mode) from the drop-down menu for TransformDefn

  24. Click Next

  25. Do not select any transform parameters, and click Next

  26. Click ... and navigate to the custom layout definition file, PromptsContainerLayout_widget.xml (for DHTML mode) or CustomPromptsSampleLayout.xml (for HTML mode) in the plugins\ModifyingPromptStyleOneReport\WEB-INF\xml\layouts subfolder inside the MicroStrategy Web installation folder. 

  27. Click Open. The path to the custom layout definition file gets filled in the Layout Definition text field. 

  28. Click Next

  29. Click Finish

  30. Perform the following steps only if you  are performing this customization for HTML mode. 

    1. Right-click Style Maps and select New Style Map to launch the Style Map Creation Wizard

    2. Select PromptsTransformCustom from the drop-down menu for Map Style From

    3. Click Add in the Map Conditions section. 

    4. Select PromptsContainerGUIMapper from the drop-down menu for Mapper Definition

    5. Select PromptsContainerCustom_widget from the drop-down menu for Map To Style

    6. Enter 2 in the Additional Data text field. 

    7. Click Finish

  31. Exit the Web Customization Editor. 

  32. Launch MicroStrategy Web to view the customization.

See Also