You need to sign in to do that
Don't have an account?
Fesal Suraitawala
Custom Report Filter logic in VF page
I have created VF page that get data from report and bind in VF page.
There is also filter functionality implemented for this custom reoport.
Now I have requirement to add Report Filter Logic like we use in standard report filter i.e. (1 AND 2 AND (3 OR 4)).
But, I am not able to add it in Apex Class.
Above is my code. Please give me suggestion, where should I add the filter logic?
There is also filter functionality implemented for this custom reoport.
Now I have requirement to add Report Filter Logic like we use in standard report filter i.e. (1 AND 2 AND (3 OR 4)).
But, I am not able to add it in Apex Class.
Reports.ReportDescribeResult describe = Reports.ReportManager.describeReport(REPORT_ID); Reports.ReportMetadata reportMetadata = describe.getReportMetadata(); List<Reports.ReportFilter> lstFilters = new List<Reports.ReportFilter>(); if(String.isNotBlank(strSpread)) { String[] spaceSize = strSpread.split(' '); if(spaceSize[0].contains('-')) { lstFilters.addAll(addRangeFilter('Deal_Quotes__c.Spread__c',spaceSize[0].split('-')[0].trim(), spaceSize[0].split('-')[1].trim())); } else if(getEndRangeString(spaceSize[spaceSize.size()-1]) != '') { String strrange = getEndRangeString(spaceSize[spaceSize.size()-1]); lstFilters.addAll(addRangeFilter('Deal_Quotes__c.Spread__c', strrange == 'above' ? spaceSize[0].trim() : null, strrange == 'above' ? null : spaceSize[0].trim())); } } if(String.isNotBlank(dateRangeFrom)) { lstFilters.add(new Reports.ReportFilter('Deal_Quotes__c.Quote_Date__c', 'greaterOrEqual', dateRangeFrom)); } if(String.isNotBlank(dateRangeTo)) { lstFilters.add(new Reports.ReportFilter('Deal_Quotes__c.Quote_Date__c', 'lessOrEqual', dateRangeTo)); } if(lstFilters.size() > 0) { reportMetadata.setReportFilters(lstFilters); } return Reports.ReportManager.runReport(REPORT_ID, reportMetadata, true);
Above is my code. Please give me suggestion, where should I add the filter logic?