MicroStrategy ONE
Displaying a List of Drill Paths for the Report
This example displays the drill paths for a report (report-level drill map). A report-level drill map are those default drill paths for a report that use the entire template of the report as the source of drilling.
Code sample
This code sample assumes that a valid sessionID, messageID and a stateID exist for the report instance that is drilled.
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 from the report instance
WebDrillInstance drillInstance = reportInstance.getDrillInstance();
//Get the drill map for the entire report
WebDrillMap drillMap = drillInstance.getDrillMap();
//Get the collection of drill paths as an enumeration
Enumeration drillPaths = drillMap.elements();
Log.logger.log(Level.INFO, " The report-level drill map has the following drill paths: ");
//Traverse the drill paths for the report and prints the information
while(drillPaths.hasMoreElements())
{
//Get the element at the current index
WebDrillPath drillPath = (WebDrillPath)drillPaths.nextElement();
//Print the ID, name, and description for the drill path
Log.logger.log(Level.INFO, "ID : " + drillPath.getID());
Log.logger.log(Level.INFO, "Name : " + drillPath.getName());
Log.logger.log(Level.INFO, "Description : " + drillPath.getDescription());
//Determine the importance index for the drill path and print it.
switch(drillPath.getImportance())
{
// high importance
case com.microstrategy.webapi.EnumDSSXMLDrillImportance.DssXmlDrillImportanceHigh :
Log.logger.log(Level.INFO, "Importance : High");
break;
// low importance
case com.microstrategy.webapi.EnumDSSXMLDrillImportance.DssXmlDrillImportanceLow :
Log.logger.log(Level.INFO, "Importance : Low");
break;
// medium importance
case com.microstrategy.webapi.EnumDSSXMLDrillImportance.DssXmlDrillImportanceMedium :
Log.logger.log(Level.INFO, "Importance : Medium");
break;
}
//Print the set name value for the drill path
Log.logger.log(Level.INFO, "Set Name : " + drillPath.getSetName());
}
}catch(WebObjectsException e) { Log.logger.log(Level.ERROR, e.getMessage);}