This example uses a DimensionListDialog
to let users specify a new set of members for an existing Product selection in a query. The example assumes that the following variables exist:
m_query
-- A Query
object that is initialized with a SALES measure, which includes the following dimensions: TIME, PRODUCT, CHANNEL, and GEOGRAPHY.
m_metadata
-- A MetadataManager
object that is currently attached to the metadata sources for the application in this example.
strProductDimension
-- A variable that contains the unique identifier of the Product dimension.
strProductHierarchy
-- A variable that contains the unique identifier of the hierarchy for the Product dimension.
The following code creates a new DimensionListDialog, retrieves the user's selection, replaces the steps of the Product selection, and applies the new selection to the query.
// Create a new DimensionListDialog. QueryAccessDimensionModel qadm = new QueryAccessDimensionModel (strProductDimension, strProductHierarchy, m_metadata); DimensionListDialog dlg = new DimensionListDialog (qadm, this); //Retrieve the user's selection into a MemberStep object. if (dlg.display () == StandardDialog.OK) { MemberStep mstep = dlg.getSelectedMembers(); try { step.setAction (Step.SELECT); } catch (InvalidStepArgException e) { e.printStackTrace(); } // Replace the current steps of the Product selection with mstep Selection prodSelection = m_query.findSelection (strProductDimension); prodSelection.removeAllSteps (); prodSelection.addStep (mstep); //Apply the new selection to the query try { m_query.applySelection (prodSelection); } catch (Exception e) { e.printStackTrace(); } }
Dimension List Dialog Bean
Identifying User Selections in a Dimension List Dialog