{
println("\nUsing COMPARISON_RULE_DESCENDING");
// Get the UNIT_PRICE_AW measure and the Source for it.
MdmMeasure mdmUnitPrice = getMdmMeasure("UNIT_PRICE_AW");
NumberSource unitPrice = (NumberSource) mdmUnitPrice.getSource();
// Get the PRODUCT and TIME dimensions.
MdmPrimaryDimension mdmProdDim = getMdmPrimaryDimension("PRODUCT_AW");
MdmPrimaryDimension mdmTimeDim = getMdmPrimaryDimension("TIME_AW");
// Get the short description attribute for the dimensions.
MdmAttribute mdmProdShortDescrAttr =
mdmProdDim.getShortValueDescriptionAttribute();
MdmAttribute mdmTimeShortDescrAttr =
mdmTimeDim.getShortValueDescriptionAttribute();
// Get the Source objects for the attributes.
Source prodShortDescr = mdmProdShortDescrAttr.getSource();
Source timeShortDescr = mdmTimeShortDescrAttr.getSource();
// Get the default hierarchies of the dimensions and their Source objects.
MdmLevelHierarchy mdmProdHier = (MdmLevelHierarchy)
mdmProdDim.getDefaultHierarchy();
MdmLevelHierarchy mdmTimeHIer = (MdmLevelHierarchy)
mdmTimeDim.getDefaultHierarchy();
Source prodHier = mdmProdHier.getSource();
StringSource timeHier = (StringSource) mdmTimeHIer.getSource();
// Get the FAMILY level of the hierarchy and the Source for it.
MdmLevel mdmFamilyLevel =
getContext().getLevelByName(mdmProdHier, "FAMILY_AW");
Source prodSel = mdmFamilyLevel.getSource();
// Join the family elements to the product short description attribute.
Source prodSelWithShortDescr = prodShortDescr.join(prodSel);
// Select the May, 2001.
Source timeSel = timeHier.selectValue("CALENDAR_YEAR_AW::MONTH_AW::59");
// Join the time selection to the time short description attribute.
Source timeSelWithShortDescr = timeShortDescr.join(timeSel);
Source result =
prodSelWithShortDescr.join(unitPrice,
unitPrice.getDataType(),
Source.COMPARISON_RULE_DESCENDING,
true)
.join(timeSelWithShortDescr);
prepareAndCommit();