다음을 통해 공유


Statement (Command Interface)

[!참고]

  이 기능은 다음 버전의 Microsoft SQL Server에서 제거됩니다. 새 개발 작업에서는 이 기능을 사용하지 말고, 현재 이 기능을 사용하는 응용 프로그램은 가능한 한 빨리 수정하십시오.

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

주의

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