Enhancement Passing Drill Fitler for OpenDocument with\without refresh
Tags:
Do you want to retreive a view of report filter by certain dimension without refreshing against the DB? How about giving user a default view and allow them to apply different set of filters, again without calling a new parameter\report refresh?
The standard OpenDocument functionally does not support filter pass through, the only option is to parameterized and refresh the report every time. With this customFilter addon will usability and performance impact if data does not need to update and you just want to pass contextual drill down.
Below is example code to on how to achieve this in SAP Business Objects XI R3.
The other standard syntax is still availlable along the support of SSO and other out of box capabilities of opendocument (http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_url_reporting_opendocument_en.pdf); this extens with capalbity to pass drill filter.
How to use it:
Same standard feature suppport of opendocument with addtional fitler parameter naming.
/OpenDocument/opendoc/logonTrustedAuth.do?dfQuarter=Q1&appKind=InfoView&sRefresh=N&isApplication=true&dfCountry=US&sType=wid&dfYear=FY2000&sDocName=webiDrill3&sTarget=customFilterTo&sReportName=Report2
How to deploy this?
1) Copy the inline .jsp code below and name it customFilterTo.jsp (new file)
2) Place customFilterTo.jsp page to folder <Tomcat>\webapps\AnalyticalReporting\Viewers\cdz_ad
folder
There is no impact to existing deployment. I have not research\found the correcsponding deployment path for BI4 yet. Welcome for suggestion!
Enjoy... Cheers...
--------------------- code below customFilterTo.jsp---------
-----------updated 7/3 for handling special characters ie New York (with space) -------------------------------------------------
<%@
include file="wistartpage.jsp" %>
<%@
page import="java.net.URLDecoder,java.net.URLEncoder" %>
<%
/**
Path: Tomcat55\webapps\AnalyticalReporting\viewers\cdz_ad
To pass slice filter use dfNameOfFilter=value
*/
response.setDateHeader(
"expires", 0);
try
{
String strViewerID = requestWrapper.getQueryParameter(
"iViewerID", true);
String strEntry = requestWrapper.getQueryParameter(
"sEntry", true);
String strHierarchy = requestWrapper.getQueryParameter(
"hierarchy", false, "");
strHierarchy = URLDecoder.decode(strHierarchy,
"UTF-8");
String strReportId = requestWrapper.getQueryParameter(
"iReport", true);
int iReport = Integer.parseInt(strReportId);
String strQueryString = requestWrapper.getQueryString();
if
(strQueryString.indexOf("df")>=0)
{
//reset next one
strQueryString= strQueryString.substring(strQueryString.indexOf(
"df"), strQueryString.length());
System.out.println(strQueryString.indexOf(
"df") + " strQueryString " + strQueryString);
DocumentInstance doc = reportEngines.getDocumentFromStorageToken(strEntry);
Reports reports = doc.getReports();
Report objReport = reports.getItem(iReport);
//delete later
DrillInfo objDrillInfo = (DrillInfo)objReport.getNamedInterface(
"DrillInfo");
DrillPath objDrillPath = objDrillInfo.getDrillPath();
objDrillPath.setAction(DrillActionType.SLICE);
DrillFromElement objDrillFromElt = (DrillFromElement)objDrillPath.getFrom().add();
DrillBar objDrillBar =
null;
DrillBarObject objDrillBarObject =
null;
int nbEltDrillBar = 0;
try
{
objDrillBar = objDrillInfo.getDrillBar();
}
catch(Exception e1) {}
if (null != objDrillBar)
nbEltDrillBar = objDrillBar.getCount();
boolean yesDrill = false;
//System.out.println(requestWrapper.getQueryString());
for (int i=0; i<nbEltDrillBar; i++)
{
objDrillBarObject = objDrillBar.getItem(i);
String strParamID = objDrillBarObject.getID();
String strParamName = objDrillBarObject.getName();
String strParamValue = requestWrapper.getQueryParameter(
"df" + strParamName) ;
System.out.println(strParamName +
" = " + strParamValue );
// Verify if the dirll filter param\value is being pass
if (strParamValue != null)
{
strParamValue = java.net.URLDecoder.decode( strParamValue );
objDrillFromElt.setObjectID(strParamID);
objDrillFromElt.setFilter( strParamValue );
objDrillInfo.executeDrill();
doc.applyFormat();
//doc.refresh(false);
strEntry = doc.getStorageToken();
//prepare for new doc instance for next drill object
if (i < nbEltDrillBar-1)
{
doc = reportEngines.getDocumentFromStorageToken(strEntry);
reports = doc.getReports();
objReport = reports.getItem(iReport);
objDrillInfo = (DrillInfo)objReport.getNamedInterface(
"DrillInfo");
objDrillPath = objDrillInfo.getDrillPath();
objDrillPath.setAction(DrillActionType.SLICE);
objDrillBar = objDrillInfo.getDrillBar();
objDrillFromElt = (DrillFromElement)objDrillPath.getFrom().add();
}
}
}
//Apply changes
//strEntry = doc.getStorageToken();
}
objUtils.setSessionStorageToken(strEntry, strViewerID, session);
requestWrapper.setQueryParameter(
"sEntry", strEntry);
out.clearBuffer();
%>
<jsp:forward page="report.jsp"></jsp:forward>
<%
}
catch
(Exception e)
{
objUtils.displayErrorMsg(e,
"_ERR_DRILL", true, out, session);
}
%>