Skip to main content

Creating a Plug-in for Multiple Cubes

Creating a Plug-in for Multiple Cubes

The previous sections describe how to create a plug-in that can be used with a single cube or subject area. You can also create a plug-in that can be used in multiple cubes. In practice, this is difficult to do because it is usually necessary to programmatically determine the fields to query.

To create a plug-in that you can use with multiple cubes, use the following additional instructions:

  • Specify the BASECUBE class parameter as one of the following:

    • A comma-separated list of logical cube or subject area names

    • "*" — refers to all cubes and subject areas in this namespace

    This option determines which cubes and subject areas can use the plug-in.

  • Include the following filter definition within the XData block:

    <filter name="%cube" displayName="Subject Area" />
    

    The name must be %cube but you can use any value for the display name.

    When you use this plug-in within the Analyzer (if applicable), the system passes the name of the current cube or subject area to this filter. Similarly, when you use this plug-in within an MDX query, the FROM clause of the query determines the value of this filter.

  • Implement the %OnGetMDX() method so that it uses the value of the %cube filter. For example:

    Method %OnGetMDX(ByRef pMDX As %String) As %Status
    {
        Set tBaseCube = ""
    
        // Use %cube filter to find the base cube
        If $IsObject(..%filterValues) {
            If (..%filterValues.%cube'="") {
                Set tBaseCube = ..%filterValues.%cube
            }
        }
    
        If (tBaseCube'="") {
            Set pMDX = "SELECT FROM "_tBaseCube
        }
        Quit $$$OK
    }
  • Ensure that the listing query can work with all the desired cubes and subject areas. Either:

    • For hardcoded listings, use only fields that are suitable in all cases.

    • Programmatically determine the fields to use.

For examples, see %DeepSee.PlugIn.MedianOpens in a new tab and %DeepSee.PlugIn.PercentileOpens in a new tab.

Determining the Listing Fields Programmatically

If the query for the plug-in specifies LISTINGSOURCE as "FactTable", there are additional tools that enable you to programmatically determine the fields to use in %OnGetListingSQL(). You can do the following:

  • Include the following filter definition within the XData block:

    <filter name="%measure" displayName="Measure" />
    

    The name must be %measure but you can use any value for the display name. This filter provides a list of all measures defined in the applicable cube or subject area.

  • Implement the %OnGetListingSQL() method as follows:

    1. Examine the value of the %measure filter.

    2. Use the %GetDimensionInfo() method of the %DeepSee.Utils class to retrieve, by reference, information about the selected measure.

      Use this information as input for the next step.

    3. Use the %GetDimensionFact() method of the %DeepSee.Utils class to retrieve the name of the field that stores the selected measure.

  • Optionally implement the %OnGetListingOrderBy() and %OnGetListingMaxRows() callbacks. For details, see the class reference for %DeepSee.KPIPlugInOpens in a new tab.

For examples, see %DeepSee.PlugIn.MedianOpens in a new tab and %DeepSee.PlugIn.PercentileOpens in a new tab. Also see the class reference for the %DeepSee.Utils class.

FeedbackOpens in a new tab