Replacing a Selection using a DimensionListDialog

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:

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