MicroStrategy ONE

Examples for Custom Groups

The sample class shipped with the SDK, CustomGroupCreationSample, shows five different ways to create a Custom Group and how to set properties on it.  Creating Custom Groups primarily involves creating new expressions, which is done just the way new filters are created.

An expression can be thought of as a tree structure with an operator (in the case of a Custom Group, the operator is an OR node) in the root of the expression. Attached to the root of the expression is  a collection of nodes (WebNodes or other classes extending it) where information about the expression can be stored.

For example, assume that you want to create a List Attribute Qualification on “Region” and include those attribute elements that begin with the word “North”. In this example, you would set the root node to an OR operator (all Custom Groups have their root set to OR). Then, you would attach an operator to the root to indicate the expression type (see EnumDSSXMLExpressionType) and the function of such an expression (see EnumDSSXMLFunction). Because you are creating a List Attribute Qualification in this example, you would set the expression type to “Filter List Qualification” and set its function to “In List”.

Once you have done this, you need the attribute that will be used for the List Attribute Qualification and the list of elements that will be used to filter. To accomplish this, you add two child nodes to the operator node. First, you add a shortcut node to the “Region” attribute (which already exist in the MicroStrategy Tutorial Project). Then, you add an object node that points to the elements of the “Region” attribute.

For simplicity, CustomGroupCreationSample does not provide details on how to obtain the ID for the attribute. The elements, however, are obtained inside a "for" loop in the sample code.

For more information on how to build different types of expressions, refer to the JavaDocs for the Custom Group interfaces and to the CustomGroupCreationSample.java class.

The following examples are provided: