Data Based Filter
Expression Use Cases.
A Data based filter expression is being applied to a data item based on the value in [Measures].[SALES_SUM] being greater than 4000.
/* Define Databased filter expression to be associated to the CARS dimension and comparison operator
DataBasedFilterExpression filterExpression = new DataBasedFilterExpression();
filterExpression.setWhatToFilter(tdi); <<== where tdi is equal to CARS
filterExpression.setComparisonOperator(operator); <<== where operator is equal to <
/* Define the dimension from which to filter the value of a measure.
ResourceScope scope = ResourceScope.BUSINESS_AND_PHYSICAL_SCOPE;
ExpressionInterface expr1 = StringExpressionUtil.getInstance().newExpression(theMap, "[Measures].[SALES_SUM]", type, scope);
memberNames.add(expr1);
filterExpression.setLeftExpression(memberNames);
/* Define the value of a measure.
ExpressionInterface expr2 = StringExpressionUtil.getInstance().newExpression(theMap, "4000", type, scope);
memberValues.add(expr2);
filterExpression.setRightExpression(memberValues);
/* Apply filter item to dataselection
FilterItem filterItem = dataSelection.newFilterItem();
filterItem.setExpression(filterExpression);
dataSelection.addBusinessItem(filterItem);
List filterList = new ArrayList();
filterList.add(filterItem);
dataSelection.setFilters(filterList);