// them.
MdmLevelHierarchy mdmCalendar = (MdmLevelHierarchy)
mdmTimeDim.getDefaultHierarchy();
MdmLevelHierarchy mdmProdPrimary = (MdmLevelHierarchy)
mdmProdStdDim.getDefaultHierarchy();
StringSource calendar = (StringSource) mdmCalendar.getSource();
StringSource prodHier = (StringSource) mdmProdPrimary.getSource();
// Get the measures and the Source objects for them.
MdmMeasure mdmUnitCost = getMdmMeasure("UNIT_COST_AW");
MdmMeasure mdmUnitPrice = getMdmMeasure("UNIT_PRICE_AW");
NumberSource unitCost = (NumberSource) mdmUnitCost.getSource();
NumberSource unitPrice = (NumberSource) mdmUnitPrice.getSource();
DataProvider dp = getContext().getDataProvider();
// Get the placeholder Source for the Number data type.
Source ph = dp.getFundamentalMetadataProvider().getNumberPlaceholder()
.getSource();
// Create a Source that specifies the value to assign as the
// value of a measure for the custom dimension member.
Source calc = ((NumberSource)
(ph.join(prodHier, "PRODUCT_PRIMARY_AW::ITEM_AW::14")))
.plus(
(NumberSource)
(ph.join(prodHier, "PRODUCT_PRIMARY_AW::ITEM_AW::15")));
// Get the level to which the dimension members belong.
MdmLevel mdmItemLevel = getContext().getLevelByName(mdmProdPrimary,
"ITEM_AW");
// Create the custom dimension member.
MdmStandardMember mdmItem60 = mdmProdStdDim.createCustomMember(
"60", // member local value
mdmItemLevel, // member level
"4", // parent local value
calc, // calculation Source
10); // precedence value
// Select a set of Product member values.
StringSource prodSel = prodHier.selectValues(
new String[]{"PRODUCT_PRIMARY_AW::ITEM_AW::14",
"PRODUCT_PRIMARY_AW::ITEM_AW::15",
"PRODUCT_PRIMARY_AW::ITEM_AW::60"});
// Produce a query that specifies the unit price and the unit cost for the