Creating Condition Steps

Extensions of the ConditionStep class implement specific behavior for each type of step that is based on a condition. The following list describes these extensions.

To use a step, you must add it to a Selection object and then apply the Selection object to a query.

AllStep example

Select the Divisions (in Level 1 of the Standard hierarchy) and the Components (in Level 2 of the Standard hierarchy) for the Product dimension.


//strProductDim is the unique identifier of the Product dimension //strStandardHier is the unique identifier of the Standard product hierarchy //level_1 is the unique identifier of Level 1 in the Standard hierarchy //level_2 is the unique identifier of Level 2 in the Standard hierarchy // Vector m_levels = new Vector (); m_levels.addElement (level_1); m_levels.addElement (level_2); // Selection sel = new Selection (strProductDim); sel.setHierarchy (strStandardHier); AllStep allStep = new AllStep (strProductDim, strStandardHier, m_levels); sel.addStep (allStep);

AttributeStep example

Select members of the Product dimension that have the colors RED or GREEN.


//strProductDim is the unique identifier of the Product dimension // Vector attribValues = new Vector (); attribValues.addElement ("RED"); attribValues.addElement ("GREEN"); // Selection sel = new Selection (strProductDim); sel.setHierarchy (strStandardHier); AttributeStep attrStep = new AttributeStep (strProductDim, null,  null, "COLOR", attribValues, AttributeStep.OP_EQUAL); sel.addStep (attrStep);

FirstLastStep example

Keep the last three months in a Time selection.

//strTimeDim is the unique identifier of the Time dimension//strStandardHier is the unique identifier of the Standard product hierarchy//level_1 is the unique identifier for Level 1 of the Standard hierarchy//sel is an existing Selection object//FirstLastStep firstLastStep = new FirstLastStep (strTimeDim,   strStandardHier, level_1, FirstLastStep.LAST, new Integer (3));firstLastStep.setAction (Step.KEEP);sel.addStep (firstLastStep);

MatchStep example

Select all products with a name that begins with the letters "abc".


//strProductDim is the unique identifier of the Product dimension //strStandardHier is the unique identifier of the Standard hierarchy // Selection sel = new Selection (strProductDim); sel.setHierarchy (strStandardHier); MatchStep matchStep = new MatchStep (strProductDim,  strStandardHier, null, MatchStep.BEGINS_WITH, "abc"); sel.addStep (matchStep);

RangeTimeStep example

Select six months starting with January, 2002.


//strTimeDim is the unique identifier for the Time dimension //strStandardHier is the unique identifier of the Standard Time hierarchy //strLevel_3 is the unique identifier of month level for the Time hierarchy // Vector monthLevel = new Vector (); monthLevel.addElement (strLevel_3); // try  {   Selection sel = new Selection (strTimeDim);  sel.setHierarchy (strStandardHier); RangeTimeStep rangeTimeStep = new RangeTimeStep (strTimeDim,      strStandardHier, monthLevel, new Integer (6),      RangeTimeStep.START_WITH, "Jan2002"); sel.addStep (rangeTimeStep); } catch (Exception e)  {   logException (e); }