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
.
MeasValStep
-- Selects members comparing data values in a measure to a specific value, such as Sales>$10,000.
MeasValRangeStep
-- Selects members by comparing to a range of data values in a measure, such as Sales between $10,000 and $20,000.
TopBottomStep
-- Selects members based on ranking within a measure, such as Top 10 products based on Sales.
TopBottomSumStep
-- Selects members whose combined values calculate to a specified percentage of a measure, such as Making up the top 10% of Sales.
TwoMeasNumStep
-- Selects members by comparing data values in one measure with data values in another measure, such as Sales>Costs+10%.
TwoMeasNumRangeStep
-- Selects members based on whether data values of one measure are within a specified range of data values of another measure, such as Sales within 10% of Costs.
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:
m_qdr1 -- References only those Sales values that satisfy the criteria: Time = January 2001; Geography = Regions of the World, and Channel = Retail.
m_qdr2 -- References only those values that satisfy the criteria: Time = Year 2001; Geography = Asia; and each Channel member.
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);
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); }
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); }
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); }
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); }
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); }
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); }