How to get report drill filters

Here is an example how to get report drill filters.

DocumentInstance doc = reportEngine.openDocument(infoObject.getID());
Reports reports = doc.getReports();
for (int i = 0; i < reports.getCount(); i++)
{
    Report report = reports.getItem(i);
    DrillInfo drillInfo = (DrillInfo) report.getNamedInterface("DrillInfo");
    DrillBar drillBar = drillInfo.getDrillBar();
    for (int j = 0; j < drillBar.getCount(); ++j) {
        DrillBarObject drillBarObject = drillBar.getItem(j);
        System.out.println(
            String.format("%s='%s'", 
                drillBarObject.getName(), 
                drillBarObject.getFilter()));
    }
}
doc.closeDocument();

Result:

Service Line='Recreation'
Year=''

5 thoughts on “How to get report drill filters

  1. Alexander

    Hi, and thank you for your informations about bo.

    Now i am able to receive the drillbar and also receive the values of the drillBarObject with the following code:

    Lov listOfValue = drillBarObject.getLOV();
    for(int a=0;a<listOfValue.getAllValues().getCount();a++){
    System.out.println("listOfValue:" + listOfValue.getAllValues().getValue(a));
    }

    Now i just want to set the drillFilter to one of the values from the listOfValues, is this possilbe?

    Cheers
    Alex

    Like

    Reply
    1. dmytro Post author

      See how it is implemented in BO:
      Tomcat55\webapps\AnalyticalReporting\viewers\cdz_adv\processDrillbar.jsp

      DrillInfo objDrillInfo = (DrillInfo)objReport.getNamedInterface("DrillInfo");
      DrillBar objDrillBar = objDrillInfo.getDrillBar();
      objDrillBar.add(strAddFilterID);
      DrillPath objDrillPath = objDrillInfo.getDrillPath();
      objDrillPath.setAction(DrillActionType.SLICE);
      objDrillInfo.executeDrill();
      

      Like

      Reply
      1. Alexander

        Hi and thanks for your response. Hopefully now I understood the usability of drillFilter. But I still have a question. Is is possible, to set a value in the filter?

        Like your first example, the value of the “Service Line” filter is ‘Recreation’. What i want to do: Receive the filter, get all possible values of the filter and set on of the possible values to the filter.

        Also from your first example. set Value of “Year” to ‘2013’. How to set the value of the filter “Year” to 2013?

        Thank you very much.
        Alex

        Like

      2. Alexander

        Hi,
        so i fixed the problem and just want to give you an update.

        ReportStructure reportStructure = documentInstance.getStructure();
        ReportElement reportElement_Structure = reportStructure.getReportElement(0);
        ReportContainer reportContainer = (ReportContainer) reportElement_Structure;
        FilterContainer filterContainer = null;
        filterContainer = reportContainer.createFilter(LogicalOperator.AND);

        reportContainer.

        ReportDictionary reportDictionary = boReport.getDocumentInstance().getDictionary();

        ReportExpression reportExpression = reportDictionary.getChildByName($FILTERNAME);
        FilterObject filterObject = filterContainer.createFilterObject(reportExpression);
        FilterCondition filterCondition = filterObject.createFilterCondition(Operator.EQUAL);
        filterCondition.createFilterConditionConstant($FILTERVALUE);
        documentInstance.applyFormat();

        Now i am able to set the filter in the document.

        Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s