Udostępnij przez


Wyliczenie ActionInvocation

Definiuje sposób Action jest wywoływana.

Przestrzeń nazw:  Microsoft.AnalysisServices
Zestaw:  Microsoft.AnalysisServices (w Microsoft.AnalysisServices.dll)

Składnia

'Deklaracja
<GuidAttribute("B3C87F4E-DC00-449d-AADB-57A239DC0B1C")> _
Public Enumeration ActionInvocation
'Użycie
Dim instance As ActionInvocation
[GuidAttribute("B3C87F4E-DC00-449d-AADB-57A239DC0B1C")]
public enum ActionInvocation
[GuidAttribute(L"B3C87F4E-DC00-449d-AADB-57A239DC0B1C")]
public enum class ActionInvocation
[<GuidAttribute("B3C87F4E-DC00-449d-AADB-57A239DC0B1C")>]
type ActionInvocation
public enum ActionInvocation

Elementy członkowskie

Nazwa elementu członkowskiego Opis
Interactive Wywołuje akcja, gdy użytkownik wykonuje akcja.
OnOpen Wywołuje akcja po moduł otwiera.
Batch Wywołuje operację z partia polecenia.

Uwagi

Nowe: 17 lipca 2006

Tylko Interactive została zaimplementowana w SQL Server 2005 Analysis Services (SSAS).

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

Za pomocą niezaimplementowany członków ActionInvocation tworzy pustą tabela z MDSCHEMA_ACTIONS wierszy.

Przykłady

Ta sekcja zawiera dwie próbki; jednej próbki przy użyciu AMO do zestaw akcja oraz innej próbki przy użyciu ADOMD.NET klient, aby pobrać akcja kodu klient.

Pokazuje poniższy przykład używa AMO, jak zestaw akcja w górę.Próbki zakłada, że są podłączone do AMOAdventureWorks przykładowej bazy danych i moduł przekazane jako parametr jest "Adventure Works".

Należy zauważyć, że Akcja wywołania jest zdefiniowana jako Interactive w kodzie.

Kod jest napisany w języku 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
}

Następujące próbki, które używa ADOMD.NET klient, pokazuje jak sprawdzić próbki akcja jest poprawnie zdefiniowany.

Parametry podane w następujący sposób.

CATALOG_NAME = AmoAdventureWorks

CUBE_NAME = Adventure Works

KOORDYNOWANIE = ([środki]. [Ilość zamówienia sprzedawcy], [produktu Product].[Kategoria].&[3])

COORDINATE_TYPE = 6

Kod jest napisany w języku C#.ServerName to System.Windows.Forms.TextBox obiektu formularza.

#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++;
}
    }

}

Po uruchomieniu kodu będą widoczne następujące wyniki.

Tabela [rowsetTable] zawiera wiersze 1

CATALOG_NAME [0]: AmoAdventureWorks

SCHEMA_NAME [0]:

CUBE_NAME [0]: Adventure Works

ACTION_NAME [0]: Szczegóły sprzedawcy

ACTION_TYPE [0]: 256

[0] WSPÓŁRZĘDNYCH: (Środki [].[Odsprzedawcy zamówienia Ilość] [produktu Product].[Kategoria].&[3])

COORDINATE_TYPE [0]: 6

ACTION_CAPTION [0]: Drążenia...

[ OPIS 0]:

ZAWARTOŚĆ [0]: Wybierz DRĄŻENIA ([środki]. [Ilość zamówienia sprzedawcy], [produktu Product].[Kategoria].&[3]) na 0 Z [Adventure Works] zwrot [Sprzedaż sprzedawcy].[Odsprzedawcy Sales Amount] [Sprzedaż sprzedawcy].[Ilość zamówienia sprzedawcy], [Sprzedaż sprzedawcy].[Cena jednostkowa sprzedawcy], [$sprzedawcy].[Sprzedawca] [$produktu].[Nazwa produktu]

APLIKACJA [0]:

WYWOŁANIA [0]: 1