MicroStrategy ONE

Drilling on a Graph

This example demonstrates drilling on a graph. This is similar to previous examples except that the drill action type used is WebDrillToGraphCoordinates and it needs the (x,y) coordinates of the pixel to be drilled on.

Code sample

This code sample assumes that a valid sessionID, messageID and a stateID exist for the report instance that is drilled. Information about the axis (the axis of the template unit from where drilling starts), and position (the position of the template unit from where drilling starts), xPixel (the value of the X-Axis pixel from where drilling starts) and yPixel (the value of the Y-Axis pixel from where drilling starts) is available as well.

 try

 {

 

   //Get the WebObjectsFactory instance

   WebObjectsFactory factory = WebObjectsFactory.getInstance();

   factory.getIServerSession().setSessionID(sessionID);

 

   //Get the Report Source from the factory

   WebReportSource reportSource = factory.getReportSource();

 

   //Use the Report Source to retrieve the Web Report instance corresponding to the given messageID and stateID

   WebReportInstance reportInstance = reportSource.getInstance(messageID, stateID);

 

   //Get the drill instance for the report instance

   WebDrillInstance drillInstance = reportInstance.getDrillInstance();

 

   //Create a collection of drill actions

   WebDrillActions drillActions = drillInstance.getDrillActions();

 

   //Add a drill action for DrillToGraphCoordinates

   WebGraphCoordinatesDrillAction action = (WebGraphCoordinatesDrillAction)drillActions.add(EnumDSSXMLDrillType.DssXmlDrillToGraphCoordinates);

 

   //Set the values for the X-Axis and Y-Axis pixels respectively

   action.setXPixel(xPixel);

   action.setYPixel(yPixel);

 

   //Perform the drilling and gets the new report instance

   WebReportInstance newReportInstance = drillInstance.drill();

 

 } catch(WebObjectsException e) { Log.logger.log(Level.ERROR, e.getMessage);}