ActionTargetType Enumeration
Identifies where an Action can be located.
Namespace: Microsoft.AnalysisServices
Assembly: Microsoft.AnalysisServices (in Microsoft.AnalysisServices.dll)
Syntax
'Declaration
<GuidAttribute("4B273BB8-914C-4b23-A8D2-7DED53B5D185")> _
Public Enumeration ActionTargetType
'Usage
Dim instance As ActionTargetType
[GuidAttribute("4B273BB8-914C-4b23-A8D2-7DED53B5D185")]
public enum ActionTargetType
[GuidAttribute(L"4B273BB8-914C-4b23-A8D2-7DED53B5D185")]
public enum class ActionTargetType
[<GuidAttribute("4B273BB8-914C-4b23-A8D2-7DED53B5D185")>]
type ActionTargetType
public enum ActionTargetType
Members
Member name | Description | |
---|---|---|
AttributeMembers | Located on an attribute member.
When you run a query for the action, the corresponding coordinate must be an attribute member. |
|
Cells | Located on a set of cells or a subcube.
When you run a query for the action, the corresponding coordinate must be a cell specification. |
|
Cube | Located on a cube.
When you run a query for the action, the corresponding coordinate must be a cube specification. |
|
DimensionMembers | Located on a dimension.
When you run a query for the action, the corresponding coordinate must be a dimension specification. |
|
Hierarchy | Located on a single hierarchy from a dimension.
When you run a query for the action, the corresponding coordinate must be a dimension specification. |
|
HierarchyMembers | Located on the members of a single hierarchy from a dimension.
When you run a query for the action, the corresponding coordinate must be a dimension specification. |
|
Level | Located on a level from a dimension.
When you run a query for the action, the corresponding coordinate must be a level specification. |
|
LevelMembers | Located on the members of a level from a dimension.
When you run a query for the action, the corresponding coordinate must be a level specification. |
|
Set | Located on a set.
When you run a query for the action, the corresponding coordinate must be a set specification. |
Remarks
New: 17 July 2006
Examples
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. This sample assumes that you are connected to the AMOAdventureWorks sample database and the cube passed as parameter is "Adventure Works".
Notice that the action target type in the AMO code is defined as Cells and the action is defined for all cells in measure group "Reseller Sales". In the ADOMD.NET code, the corresponding coordinate type is MDACTION_COORDINATE_CELL = 6, which is accompanied by the tuple ([Measures].[Reseller Order Quantity], [Product].[Category].&[3]) as the coordinate to find the action.
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 = cube.ID;
cb1.CubeDimensionID = "Reseller";
cb1.AttributeID = "Reseller";
cb1.Type = AttributeBindingType.All;
action.Columns.Add(cb1);
CubeAttributeBinding cb2 = new CubeAttributeBinding();
cb2.CubeID = cube.ID;
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