MoveToCategory Method

The MoveToCategory method moves a child category to a different parent category.

Syntax

Category .MoveToCategory(Parent [, Sibling]

Applies To

Category Object

Discussion

You can move the category to any level below the new parent. The Sibling parameter gives you a way to position the moved category within the list of existing categories at the new position.

You can also use the ConnectWithCategory and MoveToLevel methods to move categories to a new position.

A COM exception is thrown in error situations. The message that is passed with the exception varies depending on the error situation. Here are some examples:

  • "The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))"
  • "trCategory(Category) : Object is of an unexpected type" (if one of the parameter are of unexpected type)

Parameter

Description

Parent

Required. Specifies the parent category to connect to.

Type: Object

Sibling

Optional. Specifies a child category in the same level to position the moved category after. If not specified, the category is moved to the end of the list of child categories. The value can be a numeric index position, a string giving an object name, or an object defined in the script.

Type: Variant

Return Type

None

Examples

objCategory 
= objModel.Dimensions("Retailers").DrillDowns(1).Categories(2)objCatToMove
= objCategory.ChildCategories(5)objCatToReceive 
= objModel.Dimensions("Retailers").DrillDowns(1).Categories(1)objCatToMove.
MoveToCategory(objCatToReceive)