Jaa


Defining the Analysis Services Event Provider

To use the Analysis Services event provider, you must define a hosted event provider in the application definition. This topic documents the property values and the arguments required by the Analysis Services event provider and provides an example of each type of MDX query type (static and dynamic).

Note

The Analysis Services event provider connects to the specified Analysis Services instance and queries the specified Analysis Services database. The account used by the Windows service or application that runs the event provider must be able to connect to the instance and must have SELECT permissions in the database.

Properties

Use the following guidelines when defining the properties of the Analysis Services event provider.

  • ProviderName (required) must be a unique name within your application.
  • ClassName (required) must be AnalysisServicesProvider.
  • Do not use the AssemblyName property. Notification Services looks in the Microsoft.SqlServer.NotificationServices.dll assembly for standard event provider information.
  • SystemName (required) usually is the name of the computer that will run this hosted event provider. For more information, see Defining Hosted Event Providers.
  • Define a timeout value (optional). The default timeout value is five minutes.
  • Define a schedule (required). For more information, see Defining Hosted Event Providers.

Arguments

The Analysis Services event provider takes eight named arguments. You can specify them in any order:

  • EventClassName (required) specifies the name of the event class for which this event provider is configured to submit events.
  • AnalysisServicesInstance (required) specifies the name of the Analysis Services instance, which may be on a remote machine, to which the event provider will connect.
  • AnalysisServicesDatabase (required) specifies the name of the Analysis Services database that the event provider will query.
  • MDXQuery is required for static queries and must not be used for dynamic queries.
    The MDXQuery value is a static MDX query that gathers event data as its value. The query must return two-dimensional data with columns that map exactly to and in the same order as the event fields of the specified event class. Values for all of the event fields must be returned.
  • RowsQuery specifies a Transact-SQL query, the results of which will be used by the XSL transform to construct elements for the ROWS axis of the MDX query dynamically. Do not use this argument for static queries.
  • SlicerQuery specifies a Transact-SQL query, the results of which will be used by the XSL transform to construct the slicer portion (the MDX WHERE clause) of the MDX query dynamically. Do not use this argument for static queries.
  • XsltFileName (required if using RowsQuery or SlicerQuery) is the path to an XSLT file name used to transform the results of the RowsQuery (and SlicerQuery, if applicable) into a complete MDX query. For an example XSLT file, see MDX Queries for Notification Services. This argument must not be specified if a static MDX query is used.

For more information about defining an event provider, see Defining Hosted Event Providers.

Static Query Definition

The following XML from an application definition file (ADF) shows a sample definition for an Analysis Services event provider that uses a static query.

<HostedProvider>
    <ProviderName>StaticASEventProvider</ProviderName>
    <ClassName>AnalysisServicesProvider</ClassName>
    <SystemName>%NSSystem%</SystemName>
    <Schedule>
        <Interval>P0DT00H00M02S</Interval>
    </Schedule>
    <ProviderTimeout>PT7M</ProviderTimeout>
    <Arguments>
        <Argument>
            <Name>EventClassName</Name>
            <Value>KPIEvents</Value>
        </Argument>
        <Argument>
            <Name>AnalysisServicesInstance</Name>
            <Value>%ASInstance%</Value>
        </Argument>
        <Argument>
            <Name>AnalysisServicesDatabase</Name>
            <Value>Adventure Works</Value>
        </Argument>
        <Argument>
            <Name>MDXQuery</Name>
            <Value>SELECT
      {[Measures].[Reseller Gross Profit Margin], 
      [Measures].[Reseller Order Quantity], 
      [Measures].[Reseller Sales Amount]} ON COLUMNS,
      {[Employee].[Employees].[Ken J. Snchez], 
      [Employee].[Employees].[Amy E. Alberts]} ON ROWS
FROM [Adventure Works] 
WHERE [Date].[Calendar].[CY 2002]</Value>
        </Argument>
    </Arguments>
</HostedProvider>

Dynamic Query Definition

The following XML from an application definition file (ADF) shows a sample definition for an Analysis Services event provider that uses a dynamic query.

<HostedProvider>
    <ProviderName>DynamicASEventProvider</ProviderName>
    <ClassName>AnalysisServicesProvider</ClassName>
    <SystemName>%NSSystem%</SystemName>
    <Schedule>
        <Interval>P0DT00H00M02S</Interval>
    </Schedule>
    <Arguments>
        <Argument>
            <Name>EventClassName</Name>
            <Value>KPIEvents</Value>
        </Argument>
        <Argument>
            <Name>AnalysisServicesInstance</Name>
            <Value>%ASInstance%</Value>
        </Argument>
        <Argument>
            <Name>AnalysisServicesDatabase</Name>
            <Value>Adventure Works</Value>
        </Argument>
        <Argument>
            <Name>RowsQuery</Name>
            <Value>SELECT EmployeeFullName as Employee
                   FROM NSKPISubscriptionsView</Value>
        </Argument>
        <Argument>
            <Name>SlicerQuery</Name>
            <Value>SELECT DATEPART(year, DATEADD(year, -2, GETDATE()))</Value>
        </Argument>
        <Argument>
            <Name>XsltFileName</Name>
            <Value>C:\NS\Transforms\MDXTransform.xslt</Value>
        </Argument>
    </Arguments>
</HostedProvider>

See Also

Concepts

Defining Hosted Event Providers
MDX Queries for Notification Services

Other Resources

Standard Event Providers
Analysis Services Event Provider
Key Concepts in MDX (MDX)

Help and Information

Getting SQL Server 2005 Assistance