Professional > Data management scripting > Data Management reference > Data Management functions > RemoveCategory
 
RemoveCategory
Removes the deprecated OldCategory from MDMObject (often used in the OnJobEnd event).
Syntax
RemoveCategory(MDMObject, QuestionName, OldCategory)
Parameters
MDMObject
Type: object
The name for the MDM document that contains QuestionName.
QuestionName
Type: string
The name of the question object from which oldCategory will be removed.
OldCategory
Type: string
The category item being moved from QuestionName.
(return)
Type: Boolean
Returns True if moving oldCategory is successful, otherwise returns False.
Notes
The category OldCategory may exist in defined categories for categorical questions, iteration categorical, or defined question categories for loop questions.
There are restrictions when using this function:
The QuestionName question type is categorical, loop numeric, or loop categorical.
Example
RemoveCategory(mdmObject, "cat", "snake")
The following table illustrates changes after running the above example:
Before removing
After removing
cat - categorical [1..]
{
Dog -,
Goldfish -,
Panda -,
Giraffe -,
snake -,
DonKnow -
};
cat - categorical [1..]
{
Dog -,
Goldfish -,
Panda -,
Giraffe -,
DonKnow -

};
RemoveCategory(mdmObject, "MyLoopCatQuestion", "snake")
The following table illustrates changes after running the above example:
Before removing
After removing
MyLoopCatQuestion - loop
{
A "A",
B "B",
C "C",
D "D"
} fields -
(
rating "rating"
categorical [1..1]
{
Dog "Dog",
Goldfish "Goldfish",
snake "snake",
Panda "Panda",
Giraffe "Giraffe"
};

) expand grid;
MyLoopCatQuestion - loop
{
A "A",
B "B",
C "C",
D "D"
} fields -
(
rating "rating"
categorical [1..1]
{
Dog "Dog",
Goldfish "Goldfish",
Panda "Panda",
Giraffe "Giraffe"
};

) expand grid;
RemoveCategory(mdmObject, "MyLoopLogicQuestion", "snake")
The following table illustrates changes after running the above example:
Before removing
After removing
MyLoopLogicQuestion - loop
{
Dog "Dog",
Goldfish "Goldfish",
Panda "Panda",
Giraffe "Giraffe",
snake "snake"
} fields -
(
YesOrNo categorical [1..1]
{
Yes "Yes",
No "No"
};

) expand grid;
MyLoopLogicQuestion - loop
{
Dog "Dog",
Goldfish "Goldfish",
Panda "Panda",
Giraffe "Giraffe"

} fields -
(
YesOrNo categorical [1..1]
{
Yes "Yes",
No "No"
};

) expand grid;
See also
Data Management functions