Creating Measure Condition Steps

MeasConditionStep is an abstract class. Each extension of this class is a step that is based on a condition that uses one or more measures. The following list describes the extensions of MeasConditionStep.

QDRs for examples

A qualified data reference (QDR) is a reference to a subset of the values in a measure. MeasureConditionStep objects are the only steps that use a QDR. The following QDRs are used in the examples in this topic:

The following code creates m_qdr1.


//strSalesMeasure is the unique identifier for the Sales measure //strSalesMeasureDim is the unique identifier for the Sales measure dimension //strTimeDim is the unique identifier for the Time dimension //strGeogDim is the unique identifier for the Geography dimension //strChannelDim is the unique identifier for the Channel dimension // m_qdr1 = new OlapQDR(strSalesMeasureDim); m_qdr1.addDimMemberPair(strTimeDim, "JAN01"); m_qdr1.addDimMemberPair(strGeogDim, "WORLD"); m_qdr1.addDimMemberPair(strChannelDim, "RETAIL"); m_qdr1.addDimMemberPair(strSalesMeasureDim, strSalesMeasure);

The following code creates m_qdr2.


//strSalesMeasure is the unique identifier for the Sales measure //strSalesMeasureDim is the unique identifier for the Sales measure dimension //strTimeDim is the unique identifier for the Time dimension //strGeogDim is the unique identifier for the Geography dimension //strChannelDim is the unique identifier for the Channel dimension // m_qdr2 = new OlapQDR(strSalesMeasureDim); m_qdr2.addDimMemberPair(strTimeDim, "2001"); m_qdr2.addDimMemberPair(strGeogDim, "ASIA"); m_qdr2.addDimMemberPair(strChannelDim, new OlapQDRMember(OlapQDRMember.VARIES)); m_qdr2.addDimMemberPair(strSalesMeasureDim, strSalesMeasure);

MeasValStep example

Select Divisions (hierarchy level 1) and Components (hierarchy level 2) where Sales are greater than $1,000,000 for January 2001, Retail Channel, in the Regions of the World.


//strStandardHier is the unique identifier for the Standard hierarchy //m_levels is a Vector that contains the unique identifiers of levels Divisions and Components //strDivisions is a unique identifier of the Divisions level in the Product Standard Hierarchy //strComponents is a unique identifier of the Components level in the Product Standard Hierarchy //sel is an existing Selection // m_levels = new Vector(); m_levels.addElement(strDivisions); m_levels.addElement(strComponents); try  {  MeasValStep   measValStep = new MeasValStep (    strProductDim, strSalesMeasure, strStandardHier, m_levels,     MeasValStep.OP_GREATER,  new Float (1000000));  measValStep.setQDR  (m_qdr1);  sel.addStep (measValStep); } catch (Exception e)  {   logException (e); }

MeasValRangeStep example

Select Products at any level where Units fall between 1 million and 1.5 million for 2001, each Channel, in Asia.


//strUnitsMeasure is the unique identifier of the Units measure //sel is an existing Selection try {  MeasValRangeStep  measValRangeStep  = new MeasValRangeStep (    strProductDim,  strStandardHier, null, strUnitsMeasure,    MeasValRangeStep.OP_BETWEEN, new Integer (1000000),  new Integer (1500000));  measValRangeStep.setQDR (m_qdr2);  sel.addStep (measValRangeStep); } catch (Exception e)  {  logException (e); }

TopBottomStep example

Remove all Products that are in the top 10 based on Sales for January 2001, for Regions of the World and Retail Channel.


//sel is an existing Selection // try {  TopBottomStep  topBotStep = new TopBottomStep (    strProductDim,  strStandardHier, null, strSalesMeasure,    TopBottomStep.TOP,  new Integer (10), false);  topBotStep.setAction (Step.REMOVE);  topBotStep.setQDR. (m_qdr1);  sel.addStep (topBotStep); } catch (Exception e)  { logException (e); }

TopBottomSumStep example

Keep Products that make up the bottom 5 percent of Sales for January 2001, Regions of the World and Retail Channel.


try {  TopBottomSumStep  topBotSumStep = new TopBottomSumStep (    strProductDim, strStandardHier, null, strSalesMeasure,    topBotSumStep.BOTTOM, new Float (5));  topBotSumStep.setAction (Step.KEEP);  topBotSumStep.setQDR (m_qdr1);  sel.addStep (topBotSumStep); } catch (Exception e)  {  logException (e); }

TwoMeasNumStep example

Select Products where Sales are less than Costs for January 2001, Regions of the World and Retail Channel.


//strCostsMeasure is the unique identifier of the Costs measure //sel is an existing Selection // try {  TwoMeasNumSteo  twoMeasNumStep = new TwoMeasNumStep (    strProductDim, strStandardHier, null, strSalesMeasure,    strCostsMeasure, TwoMeasNumStep.OP_LESS);  twoMeasNumStep.setQDR (m_qdr1);  sel.addStep (twoMeasNumStep); } catch (Exception e)  {  logException (e); }

TwoMeasNumRangeStep example

Select Products where Sales are not within 10 percent of the Costs for 2001, Asia, and each Channel.


//strCostsMeasure is the unique identifier of the Costs measure //sel is an existing Selection //  try  {  TwoMeasNumRangeStep  twoMeasNumRangeStep = new TwoMeasNumRangeStep (    strProductDim, strStandardHier, null, strSalesMeasure, strCostsMeasure,    TwoMeasNumRangeStep.OP_OUTSIDE, new Float (10), true);  twoMeasNumRangeStep.setQDR (m_qdr2);  sel.addStep (twoMeasNumRangeStep); } catch (Exception e) {  logException (e); }