OrdinalPosition (Command Interface)
[!附註]
下一版的 Microsoft SQL Server 將不再提供此功能。請勿在新的開發工作中使用此功能,並且儘速修改使用此功能的應用程式。
The OrdinalPosition property of the Command interface contains the ordinal position of a command in the Commands collection in the parent MDStore object.
Applies To:clsCubeCommand, clsDatabaseCommand, clsRoleCommand
Data Type
Integer
Access
Read-only
備註
Ordinal position determines the order in which commands are executed. This order is important when one command depends on another command (for example, a CREATE SET command that uses a member defined in a CREATE MEMBER command). In this case, the CREATE MEMBER command should have a lower OrdinalPosition property value than the CREATE SET command. However, the ordinal position of the command does not affect the solve order of the calculated member or calculated cells definition the command may create. For more information on how solve order affects calculated cells and calculated members, see Understanding Pass Order and Solve Order.
範例
The following code creates three new commands in the Commands collection of the FoodMart 2000 database. It then enumerates the collection, printing the OrdinalPosition and Name properties to the Debug window. Then, the code example deletes and re-creates the first command, and again enumerates the collection to demonstrate the change in ordinal position on the other commands.
Dim dsoServer As New DSO.Server
Dim dsoDB As DSO.MDStore
Dim dsoCmd As DSO.Command
' Connect to the local Analysis server.
dsoServer.Connect "LocalHost"
' Open the FoodMart 2000 database.
Set dsoDB = dsoServer.MDStores("FoodMart 2000")
' Add three sample commands.
Set dsoCmd = dsoDB.Commands.AddNew("Command3")
Set dsoCmd = dsoDB.Commands.AddNew("Command1")
Set dsoCmd = dsoDB.Commands.AddNew("Command2")
' Iterate through the commands for the database.
For Each dsoCmd In dsoDB.Commands
' Print its name and ordinal position
Debug.Print dsoCmd.OrdinalPosition & " = " & dsoCmd.Name
Next
' Now, delete the Command3 command and add it again.
dsoDB.Commands.Remove "Command3"
Set dsoCmd = dsoDB.Commands.AddNew("Command3")
' Iterate again through the commands for the database.
Debug.Print "-----"
For Each dsoCmd In dsoDB.Commands
' Print its name and ordinal position
Debug.Print dsoCmd.OrdinalPosition & " = " & dsoCmd.Name
Next