MicroStrategy ONE

Web Expression Architecture

Filter expressions in MicroStrategy can be simple single-node expressions or they can contain multiple qualifications to create more complex expressions. It is possible to use the MicroStrategy Web SDK to programmatically build an expression that contains one or more qualifications. Creating expressions programmatically can be helpful if one wants to dynamically answer an attribute or hierarchy qualification prompt at runtime.

For example, assume that a report includes a hierarchy qualification prompt that contains the Customers hierarchy. When that report is run in MicroStrategy Web, multiple qualifications can be specified. They appear like this in the prompt page.

When the report results are returned, the filter expression appears in the report filter editor area of the report page as shown below.

Although this filter expression looks like a flat string, it is actually made up of several individual components called nodes, which are arranged in a tree-like structure. This particular expression is made up of two sub-expressions and can be visualized like a tree as shown below.

The root node always points to the operator of the expression and can never be null. In this example, the root node is set to the 'AND' operator of this branch qualification expression.

The root node of an expression cannot be removed or replaced, but it is possible to define what type of expression is being created and what operator (or function) it must be set to. In the case of this example, the following must be set:

root.setExpressionType(EnumDSSXMLExpressionType.DssXmlFilterBranchQual);

root.setFunction(EnumDSSXMLFunction.DssXmlFunctionAnd);

Click here to see the complete list of possible expression types.

Click here to see the complete list of functions (or operators).

The left branch qualification is 'Customer Region in List (South, Southeast, Southwest)'. It is made up of an 'In' operator node that contains two child nodes. The first is a shortcut to the Customer Region attribute, and the other is a node that contains the individual attribute elements used for qualification.

The right branch qualification is 'Customer Age (ID) Between 21 and 35'. This sub-expression begins with the operator node 'Between' and contains three child nodes. The first is a form shortcut node pointing to the ID form of the Customer Age attribute, and the other two are constant value nodes that contain the numeric values that are the start and end points of the between expression. In this case, the constant values are of type real number, but depending on the column data type to which this attribute form is pointing, it can also be a float, integer, double, big decimal, etc.

Click here to see the complete list of data types.

This expression can be created programmatically using the MicroStrategy Web SDK. See Creating a Hierarchy Qualification Report Prompt for sample code and a detailed explanation of how to do this.