Statement (Command Interface)

Analysis Services Programming

Analysis Services Programming

Statement (Command Interface)

The Statement property of the Command interface contains the text of the command statement.

Applies To

clsCubeCommand

clsDatabaseCommand

clsRoleCommand

Data Type

String

Access

Read/write

Remarks

For more information about types of command statements, see CommandType.

The names used in statements that define actions, calculated members, named sets, and calculated cells must be unique within a cube. For example, if you create an action named Test, you cannot create a calculated cells definition named Test. For more information about naming conventions for Decision Support Objects, see Considerations For Naming Decision Support Objects.

Examples
A. Creating a Command Object (cmdCreateAction)

Use the following code to create a cmdCreateAction command object:

CommandObject.Statement = "CREATE ACTION Sales.ShowCustDetails " & _
    "FOR [Customer] MEMBERS As " & _
    "'IIf(Customers.CurrentMember.Properties(""Existing Customer"")" & _
    " = ""True""," & _
    """http://MyServer/CustomerDetails.ASP?CustID="" + " & _
    "Customers.CurrentMember.ID,'') " & _
    "TYPE = URL " & _
    "APPLICATION = 'IE' " & _
    "DESCRIPTION = 'Launch the customer details page for " & _
    "this specific customer.'"

You can use CURRENTCUBE in command statements to refer to the cube that contains the command object. This syntax makes it easier to copy command objects between cubes. For example, you can reconstruct the previous statement as:

CommandObject.Statement = "CREATE ACTION CURRENTCUBE.ShowCustDetails " & _
    "FOR [Customer] MEMBERS As " & _
    "'IIf(Customers.CurrentMember.Properties(""Existing Customer"")" & _
    " = ""True""," & _
    """http://MyServer/CustomerDetails.ASP?CustID="" + " & _
    "Customers.CurrentMember.ID,'') " & _
    "TYPE = URL " & _
    "APPLICATION = 'IE' " & _
    "DESCRIPTION = 'Open the customer details page for " & _
    "this specific customer.'"
B. Creating a Command Object (cmdCreateMember)

Use the following code to create a cmdCreateMember command object:

CommandObject.Statement = "CREATE MEMBER Sales.Measures.PROFIT AS " & _
    "'Measures.Sales - Measures.Cost'"
C. Creating a Command Object (cmdCreateSet)

Use the following code to create a cmdCreateSet command object:

CommandObject.Statement = "CREATE SET CURRENTCUBE.[ImportedBeer] AS " & _
    "'Filter(Product.Members, " & _
    "(InStr(1, Product.CurrentMember.Name, ""Imported Beer"")))'"
D. Creating a Command Object (cmdUseLibrary)

Use the following code to create a cmdUseLibrary command object:

CommandObject.Statement = "USE LIBRARY ""MyStatFunctions.dll"""
E. Creating a Command Object (cmdCreateCellCalculation)

Use the following code to create a cmdCreateCellCalculation command object:

CommandObject.Statement = CREATE SESSION CELL CALCULATION " & _
    "[Sales].[Mexico Adjustments] FOR " & _
    "'(Descendants([Mexico], [City], SELF))' & _
    "AS '<expression>'," & _
    "CONDITION = '[Time].CURRENTMEMBER.NAME=[2000]'"
F. Returning a Command Object Statement

Use the following code to return a command object statement:

Dim strCommandStatement As String
strCommandStatement = CommandObject.Statement

See Also

Command Interface

CREATE MEMBER Statement

CREATE SET Statement

MDX (Administrative Tools)