Compound Step Use Cases.

Example 1: Compound step with only one step.

MDX Generated:

 

WITH SET [DATAITEM_DTE] AS '.[DTE].MEMBERS' 

SET [DATAITEM_CAR] AS '{[CARS].[All Cars].[Chevy], [CARS].[All Cars].[Ford]}' 

MEMBER [Measures].[SALES_SUM] AS '[Measures].[SALES_SUM]' 

SELECT CROSSJOIN({[DATAITEM_DTE]}, CROSSJOIN({[DATAITEM_CAR]}, {[Measures].[SALES_SUM]})) ON COLUMNS FROM MDDBCARS

Code to generate MDX:

 

String[] memberNames = {"[CARS].[All Cars].[Chevy]","[CARS].[All Cars].[Ford]"};

DataItemMemberFilter step1 = new DataItemMemberFilter(memberNames, DataItemMemberFilter.LIST_MEMBER_FILTER_TYPE);

step1.setActionType(StepFilterInterface.INITIAL_ACTION_TYPE);

CompoundStep cs = new CompoundStep();

cs.addStep(step1);

Example 2: Testing compound step with member filter and rank steps using an "AND" condition.

MDX Generated:

 

WITH SET [DATAITEM_DTE] AS '.[DTE].MEMBERS' 

SET [DATAITEM_CAR] AS 'INTERSECT(TopCount({[CARS].[CAR].MEMBERS}, 50, [Measures].[SALES_SUM]), {[CARS].[All Cars].[Chevy], [CARS].[All Cars].[Ford]})' 

MEMBER [Measures].[SALES_SUM] AS '[Measures].[SALES_SUM]' 

SELECT CROSSJOIN({[DATAITEM_DTE]}, CROSSJOIN({[DATAITEM_CAR]}, {[Measures].[SALES_SUM]})) ON COLUMNS FROM MDDBCARS

Code to generate MDX:

 

String[] memberNames = {"[CARS].[All Cars].[Chevy]","[CARS].[All Cars].[Ford]"};

DataItemMemberFilter step1 = new DataItemMemberFilter(memberNames, DataItemMemberFilter.LIST_MEMBER_FILTER_TYPE);

step1.setActionType(StepFilterInterface.INITIAL_ACTION_TYPE);

int value = 50;

String[] byRank = {"[Measures].[SALES_SUM]" };

DataItemRankFilter step2 = new DataItemRankFilter(DataItemRankFilter.TOP, value, byRank , DataItemRankFilter.COUNT);

step2.setActionType(StepFilterInterface.INITIAL_ACTION_TYPE);

CompoundStep cs = new CompoundStep();

cs.addStep(step1);

cs.setConditionType(CompoundStep.AND_CONDITION);

cs.addStep(step2);

Example 3: Testing compound step with Two Filter steps using an AND condition

MDX Generated:

 

WITH SET [DATAITEM_DTE] AS '.[DTE].MEMBERS' 

SET [DATAITEM_CAR] AS 'INTERSECT({[CARS].[All Cars].[Ford]}, {[CARS].[All Cars].[Chevy], [CARS].[All Cars].[Ford]})' 

MEMBER [Measures].[SALES_SUM] AS '[Measures].[SALES_SUM]' 

SELECT CROSSJOIN({[DATAITEM_DTE]}, CROSSJOIN({[DATAITEM_CAR]}, {[Measures].[SALES_SUM]})) ON COLUMNS FROM MDDBCARS

Code to generate MDX:

 

String[] memberNames1 = {"[CARS].[All Cars].[Chevy]","[CARS].[All Cars].[Ford]"};

DataItemMemberFilter step1 = new DataItemMemberFilter(memberNames1, DataItemMemberFilter.LIST_MEMBER_FILTER_TYPE);

step1.setActionType(StepFilterInterface.INITIAL_ACTION_TYPE);

String[] memberNames2 = {"[CARS].[All Cars].[Ford]"};

DataItemMemberFilter step2 = new DataItemMemberFilter(memberNames2, DataItemMemberFilter.LIST_MEMBER_FILTER_TYPE);

step2.setActionType(StepFilterInterface.INITIAL_ACTION_TYPE);

CompoundStep cs = new CompoundStep();

cs.addStep(step1);

cs.setConditionType(CompoundStep.AND_CONDITION);

cs.addStep(step2);

Example 4: Testing compound step with navigation level filter ([CARS].[CAR]) and apply top count step using an "AND" condition.

MDX Generated:

WITH SET [DATAITEM_DTE] AS '.[DTE].MEMBERS' 

SET [DATAITEM_CAR] AS '{ INTERSECT(TopCount({[CARS].[CAR].MEMBERS}, 50, [Measures].[SALES_SUM]), [CARS].[CAR].MEMBERS)}' 

MEMBER [Measures].[SALES_SUM] AS '[Measures].[SALES_SUM]' 

SELECT CROSSJOIN({[DATAITEM_DTE]}, CROSSJOIN({[DATAITEM_CAR]}, {[Measures].[SALES_SUM]})) ON COLUMNS FROM MDDBCARS

Code to generate MDX:

 

DataItemNavigationFilter step1 = new DataItemNavigationFilter(DataItemNavigationFilter.LEVEL_NAVIGATION_FILTER_TYPE, "[CARS]", "[CAR]");

step1.setActionType(StepFilterInterface.INITIAL_ACTION_TYPE);

System.out.println("Applying TopCount step to " );

int value = 50;

String[] byRank = {"[Measures].[SALES_SUM]" };

DataItemRankFilter step2 = new DataItemRankFilter(DataItemRankFilter.TOP, value, byRank , DataItemRankFilter.COUNT);

CompoundStep cs = new CompoundStep();

cs.addStep(step1);

cs.setConditionType(CompoundStep.AND_CONDITION);

cs.addStep(step2);

Example 5:  Testing compound step with Two Member Filter steps using an "OR" condition.

MDX Generated:

WITH SET [DATAITEM_DTE] AS '.[DTE].MEMBERS' 

SET [DATAITEM_CAR] AS 'UNION({[CARS].[All Cars].[Ford]}, {[CARS].[All Cars].[Chevy], [CARS].[All Cars].[Ford]})' 

MEMBER [Measures].[SALES_SUM] AS '[Measures].[SALES_SUM]' 

SELECT CROSSJOIN({[DATAITEM_DTE]}, CROSSJOIN({[DATAITEM_CAR]}, {[Measures].[SALES_SUM]})) ON COLUMNS FROM MDDBCARS

Code to generate MDX:

 

String[] memberNames1 = {"[CARS].[All Cars].[Chevy]","[CARS].[All Cars].[Ford]"};

DataItemMemberFilter step1 = new DataItemMemberFilter(memberNames1, DataItemMemberFilter.LIST_MEMBER_FILTER_TYPE);

step1.setActionType(StepFilterInterface.INITIAL_ACTION_TYPE);

String[] memberNames2 = {"[CARS].[All Cars].[Ford]"};

DataItemMemberFilter step2 = new DataItemMemberFilter(memberNames2, DataItemMemberFilter.LIST_MEMBER_FILTER_TYPE);

step2.setActionType(StepFilterInterface.INITIAL_ACTION_TYPE);

CompoundStep cs = new CompoundStep();

cs.addStep(step1);

cs.setConditionType(CompoundStep.OR_CONDITION);

cs.addStep(step2);

Example 6: Testing compound step with two data based filter steps using an 'AND" condition.

MDX Generated:

WITH SET [DATAITEM_DTE] AS '.[DTE].MEMBERS' 

SET [DATAITEM_CAR] AS ' { FILTER({[CARS].[CAR].MEMBERS}, ([Measures].[SALES_SUM] < 5000000) AND ([Measures].[SALES_SUM] > 1))}' 

MEMBER [Measures].[SALES_SUM] AS '[Measures].[SALES_SUM]' 

SELECT CROSSJOIN({[DATAITEM_DTE]}, CROSSJOIN({[DATAITEM_CAR]}, {[Measures].[SALES_SUM]})) ON COLUMNS FROM MDDBCARS

 

Code to generate MDX:

 

protected ComparisonOperator operator1 = ComparisonOperator.COMPARE_GT;

protected ComparisonOperator operator2 = ComparisonOperator.COMPARE_LT;

String[] measureName = {"[Measures].[SALES_SUM]"};

int val = 1;

Integer vall = new Integer(val);

Object value = (Object) vall;

DataItemDataBasedFilter step1 = new DataItemDataBasedFilter(measureName, operator1, value);

step1.setActionType(StepFilterInterface.INITIAL_ACTION_TYPE);

int val2 = 5000000;

Integer vall2 = new Integer(val2);

Object value2 = (Object) vall2;

DataItemDataBasedFilter step2 = new DataItemDataBasedFilter(measureName, operator2, value2);

step2.setActionType(StepFilterInterface.INITIAL_ACTION_TYPE);

CompoundStep cs = new CompoundStep();

cs.addStep(step1);

cs.setConditionType(CompoundStep.AND_CONDITION);

cs.addStep(step2);

Example 7:  Testing compound step with three data based filter steps using a "AND/OR" conditions.

MDX Generated:

WITH SET [DATAITEM_DTE] AS '.[DTE].MEMBERS'

SET [DATAITEM_CAR] AS ' { FILTER({[CARS].[CAR].MEMBERS}, ([Measures].[SALES_SUM] = 612000) OR ([Measures].[SALES_SUM] < 5000000) AND ([Measures].[SALES_SUM] > 1))}'

MEMBER [Measures].[SALES_SUM] AS '[Measures].[SALES_SUM]'

SELECT CROSSJOIN({[DATAITEM_DTE]}, CROSSJOIN({[DATAITEM_CAR]}, {[Measures].[SALES_SUM]})) ON COLUMNS FROM MDDBCARS

Code to generate MDX:

 

protected ComparisonOperator operator1 = ComparisonOperator.COMPARE_GT;

protected ComparisonOperator operator2 = ComparisonOperator.COMPARE_LT;

protected ComparisonOperator operator3 = ComparisonOperator.COMPARE_EQ;

String[] measureName = {"[Measures].[SALES_SUM]"};

int val = 1;

Integer vall = new Integer(val);

Object value = (Object) vall;

DataItemDataBasedFilter step1 = new DataItemDataBasedFilter(measureName, operator1, value);

step1.setActionType(StepFilterInterface.INITIAL_ACTION_TYPE);

int val2 = 5000000;

Integer vall2 = new Integer(val2);

Object value2 = (Object) vall2;

DataItemDataBasedFilter step2 = new DataItemDataBasedFilter(measureName, operator2, value2);

step2.setActionType(StepFilterInterface.INITIAL_ACTION_TYPE);

int val3 = 612000;

Integer vall3 = new Integer(val3);

Object value3 = (Object) vall3;

DataItemDataBasedFilter step3 = new DataItemDataBasedFilter(measureName, operator3, value3);

step2.setActionType(StepFilterInterface.INITIAL_ACTION_TYPE);

CompoundStep cs = new CompoundStep();

cs.addStep(step1);

cs.setConditionType(CompoundStep.AND_CONDITION);

cs.addStep(step2);

cs.setConditionType(CompoundStep.OR_CONDITION);

cs.addStep(step3);