Desktop User Guides > 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
The name for the MDM document that contains QuestionName.
Type: object
QuestionName
The name of the question object from which oldCategory will be removed.
Type: string
OldCategory
The category item being moved from QuestionName.
Type: string
(return)
Returns True if moving oldCategory is successful, otherwise returns False.
Type: Boolean
Notes
The category OldCategory might exist in defined categories for categorical questions, iteration categorical, or defined question categories for loop questions.
The QuestionName question type is categorical, loop numeric, or loop categorical.
Example 1
RemoveCategory(mdmObject, "cat", "tiger")
Before removing
After removing
cat - categorical [1..]
{
Dog -,
Goldfish -,
Panda -,
Giraffe -,
Tiger -,
DonKnow -
};
cat - categorical [1..]
{
Dog -,
Goldfish -,
Panda -,
Giraffe -,
DonKnow -

};
RemoveCategory(mdmObject, "MyLoopCatQuestion", "tiger")
Example 2
The following table illustrates changes after running this 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",
Tiger "Tiger",
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;
Example 3
RemoveCategory(mdmObject, "MyLoopLogicQuestion", "snake")
The following table illustrates changes after running this example:
Before removing
After removing
MyLoopLogicQuestion - loop
{
Dog "Dog",
Goldfish "Goldfish",
Panda "Panda",
Giraffe "Giraffe",
Tiger "tiger"
} 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