Compartir a través de


ActionInvocation Enumeration

Defines how an Action is called.

Espacio de nombres: Microsoft.AnalysisServices
Ensamblado: Microsoft.AnalysisServices (in microsoft.analysisservices.dll)

Sintaxis

'Declaración
<GuidAttribute("B3C87F4E-DC00-449d-AADB-57A239DC0B1C")> _
Public Enumeration ActionInvocation
[GuidAttribute("B3C87F4E-DC00-449d-AADB-57A239DC0B1C")] 
public enum ActionInvocation
[GuidAttribute(L"B3C87F4E-DC00-449d-AADB-57A239DC0B1C")] 
public enum class ActionInvocation
/** @attribute GuidAttribute("B3C87F4E-DC00-449d-AADB-57A239DC0B1C") */ 
public enum ActionInvocation
GuidAttribute("B3C87F4E-DC00-449d-AADB-57A239DC0B1C") 
public enum ActionInvocation

Members

Member name Description
Batch Calls the action from a batch command.
Interactive Calls the action when a user performs an action.
OnOpen Calls the action when the cube opens.

Notas

Nuevo:17 de julio de 2006

Only Interactive has been implemented in SQL Server 2005 Analysis Services (SSAS).

Batch and OnOpen members will be implemented in future releases of SQL Server Analysis Services.

Using unimplemented members of ActionInvocation creates an empty table from the MDSCHEMA_ACTIONS Rowset.

Ejemplo

This section includes two samples; one sample using AMO to set up the action and another sample using ADOMD.Net client to retrieve the action from client code.

The following sample, which uses AMO, shows how to set up an action. The sample assumes that you are connected to AMOAdventureWorks sample database and the cube passed as parameter is "Adventure Works".

Notice that action invocation is defined as Interactive in the code.

The code is written in C#.

#region Using directives
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.Globalization;
using System.Text;
using System.Data;
using System.Data.OleDb;
using System.Data.Sql;
using Microsoft.AnalysisServices;
#endregion 
private void CreateActions(Cube cube)
{
    #region Adding a drillthrough action
    //Create a Drillthrough action
    DrillThroughAction action = new DrillThroughAction("Reseller Details", "Drillthrough Action");

    //Define the Action
    action.Invocation = ActionInvocation.Interactive;
    action.Type = ActionType.DrillThrough;
    action.TargetType = ActionTargetType.Cells;
    action.Target = "MeasureGroupMeasures(\"Reseller Sales\")";
    action.Caption = "DrillThrough...";
    action.CaptionIsMdx = false;

    //Adding Measure columns
    MeasureBinding mb1 = new MeasureBinding();
    mb1.MeasureID = "Reseller Sales Amount";
    action.Columns.Add(mb1);

    MeasureBinding mb2 = new MeasureBinding();
    mb2.MeasureID = "Reseller Order Quantity";
    action.Columns.Add(mb2);

    MeasureBinding mb3 = new MeasureBinding();
    mb3.MeasureID = "Reseller Unit Price";
    action.Columns.Add(mb3);

    //Adding Dimension Columns
    CubeAttributeBinding cb1 = new CubeAttributeBinding();
    cb1.CubeID = "Amo Adventure Works";
    cb1.CubeDimensionID = "Reseller";
    cb1.AttributeID = "Reseller";
    cb1.Type = AttributeBindingType.All;
    action.Columns.Add(cb1);

    CubeAttributeBinding cb2 = new CubeAttributeBinding();
    cb2.CubeID = "Amo Adventure Works";
    cb2.CubeDimensionID = "Product";
    cb2.AttributeID = "Product Name";
    cb2.Type = AttributeBindingType.All;
    action.Columns.Add(cb2);

    //Add the defined action to the cube
    cube.Actions.Add(action);
    #endregion
}

The following sample, which uses the ADOMD.Net client, shows how to verify that the action sample is defined correctly.

The parameters were given as follows.

CATALOG_NAME= AmoAdventureWorks

CUBE_NAME=Adventure Works

COORDINATE=([Measures].[Reseller Order Quantity], [Product].[Category].&[3])

COORDINATE_TYPE=6

Code is written in C#. ServerName is a System**.Windows.Forms.Textbox** object on a Form.

#region Using directives
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using adoMdClient = Microsoft.AnalysisServices.AdomdClient;
#endregion

...

private enum COORDINATE_TYPE
{
    MDACTION_COORDINATE_CUBE = 1,
    MDACTION_COORDINATE_DIMENSION = 2,
    MDACTION_COORDINATE_LEVEL = 3,
    MDACTION_COORDINATE_MEMBER = 4,
    MDACTION_COORDINATE_SET = 5,
    MDACTION_COORDINATE_CELL = 6
}

...

private void readActionsUsingADOMDClient(String catalogName, String cubeName, String coordinate, COORDINATE_TYPE coordinateType)
{
    adoMdClient.AdomdRestrictionCollection restrictions = new adoMdClient.AdomdRestrictionCollection();

    restrictions.Add("CATALOG_NAME", catalogName);

    restrictions.Add("CUBE_NAME", cubeName);

    restrictions.Add("COORDINATE", coordinate);

    restrictions.Add("COORDINATE_TYPE", (int)coordinateType);
    foreach (adoMdClient.AdomdRestriction restriction in restrictions)
    {
Debug.WriteLine(restriction.Name + "=" + restriction.Value);
    }
    using (adoMdClient.AdomdConnection cnxAmoAdventureworks = new adoMdClient.AdomdConnection())
    {
if (serverName.Text.Length == 0)
{
    cnxAmoAdventureworks.ConnectionString = "Data Source=localhost;Catalog=AMOAdventureworks";
}
else
{
    cnxAmoAdventureworks.ConnectionString = "Data Source=" + serverName.Text + ";Catalog=AMOAdventureworks";
}
cnxAmoAdventureworks.Open();


DataTable actionsTable = cnxAmoAdventureworks.GetSchemaDataSet("MDSCHEMA_ACTIONS", restrictions).Tables[0];
Debug.WriteLine("Table [" + actionsTable.TableName + "] has " + actionsTable.Rows.Count.ToString() + " rows");
int j = 0;
foreach (DataRow actionRow in actionsTable.Rows)
{
    for (int i = 0; i < actionRow.ItemArray.Length; i++)
    {
Debug.WriteLine("[" + j.ToString().PadLeft(4) + "]\t" + actionsTable.Columns[i].ColumnName + ": " + actionRow.ItemArray[i].ToString());
    }
    j++;
}
    }

}

After running the code you will see the following results.

Table [rowsetTable] has 1 rows

[ 0] CATALOG_NAME: AmoAdventureWorks

[ 0] SCHEMA_NAME:

[ 0] CUBE_NAME: Adventure Works

[ 0] ACTION_NAME: Reseller Details

[ 0] ACTION_TYPE: 256

[ 0] COORDINATE: ([Measures].[Reseller Order Quantity], [Product].[Category].&[3])

[ 0] COORDINATE_TYPE: 6

[ 0] ACTION_CAPTION: DrillThrough...

[ 0] DESCRIPTION:

[ 0] CONTENT: DRILLTHROUGH Select ([Measures].[Reseller Order Quantity], [Product].[Category].&[3]) on 0 From [Adventure Works] RETURN [Reseller Sales].[Reseller Sales Amount],[Reseller Sales].[Reseller Order Quantity],[Reseller Sales].[Reseller Unit Price],[$Reseller].[Reseller],[$Product].[Product Name]

[ 0] APPLICATION:

[ 0] INVOCATION: 1

Plataformas

Plataformas de desarrollo

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Plataformas de destino

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Vea también

Referencia

Microsoft.AnalysisServices Namespace