Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Caching, bookmarks in Drill through reports
mailtorake
All,
I have a master report from which I drill 6 levels down with hyperlink option at each level.
eg:
Master
Child1
Child2
.....
Child6
At any child level, I should be able to go to the prior pages; I do have drill-down links for now, but is there a way of caching the pages once visited? or may be bookmarking them for a later use?
I have been searching for caching or bookmarks in birt, but couldn't come across an appropriate article or example.
Any kind of help or pointers will be greatly appreciated.
Thanks
Rakesh
Find more posts tagged with
Comments
JasonW
Rakesh,<br />
<br />
I just posted an example of a simple bread crumb scheme on DevShare.<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/devshare/designing-birt-reports/1123-simple-bread-crumb-example/#description'>Simple
bread crumb example - Designs & Code - BIRT Exchange</a><br />
<br />
<br />
Jason
mailtorake
Awesome!! Exactly what I wanted.
Thanks a lot, Jason.
Happy New Year
Rakesh
mailtorake
Hi Jason,
Your approach was working for me (the parameters were retained), but the reports are being re-run(slower), instead of being re-rendered (faster).
My question is: should I be changing the birt engine (the java part which handles running and rendering the reports) behavior to keep track of urls and not to run but to render if the report was run, already?
Or
Is there any other way of achieving the same? overwrite=false etc?
It would really help me if user doesn't have to wait longer the second time he access the same url. Any kind of pointers or help would be greatly appreciated.
Thanks
Rakesh
JasonW
Change the beforeFactory script in each of the reports to look like this:
importPackage( Packages.java.net );
tst = reportContext.getHttpServletRequest().getRequestURL()+"?";
tst += reportContext.getHttpServletRequest().getQueryString();
var vab = reportContext.getHttpServletRequest().getRequest().getAttribute("attributeBean");
rd = vab.getReportDocumentName();
if( rd != null ){
var erd = URLEncoder.encode( rd,"UTF-8");
tst += "&__document="+erd;
}
reportContext.getHttpServletRequest().getSession().setAttribute("level1", tst);
Change the last line to match the level for each report. We are using the report document that is stored in the ViewerAttributeBean.
Jason
mailtorake
Hi Jason,
Thanks a ton for responding with the block of code.
I was getting an error: TypeError: Cannot find function getRequest in object org.apache.catalina.connector.RequestFacade@18b09bf. (/report/method[
@name="
;beforeFactory"]#7)
because of which I had to change the following line
var vab = reportContext.getHttpServletRequest().getRequest().getAttribute("attributeBean");
to
var vab = reportContext.getHttpServletRequest().getAttribute("attributeBean");
But I get the following error now:
+ Cannot access the document file : C:Documents and Settingsrprathikantamapache-tomcat-6.0.16webappsssvuidocumentsBIRTDOC58F9FB2C19531598308716B0DB1E9EC720100106_173015_707Reports/PerformanceReports/ByPlacement/1CampaignMaster.rptdocument
I've checked that the path is correct and file exists.
What could be the issue? Permissions??
Some of my server settings are as follows:
app-root:ssvui
Report design directory: ssvui/Reports/report-specific-sub-folders
Documents are getting stored in: ssvui/documents
Thanks
Rakesh
JasonW
Yes It appears that was a typo.
If you hit the plus (+) beside the arrow do you get any more details? You could also start the master report with the document specified by you, but that may cause you cleanup problems later.
Jason
mailtorake
Following is the stack trace after expanding the message:
org.eclipse.birt.report.exception.ViewerException: Cannot access the document file : C:Documents and Settingsrprathikantamapache-tomcat-6.0.16webappsssvuidocumentsBIRTDOC6E2D494CABFD93D0D1EC50A47116C83020100106_180936_738Reports/PerformanceReports/ByPlacement/1CampaignMaster.rptdocument.
at org.eclipse.birt.report.context.ViewerAttributeBean.getDesignHandle(ViewerAttributeBean.java:631)
at org.eclipse.birt.report.context.ViewerAttributeBean.__init(ViewerAttributeBean.java:231)
at org.eclipse.birt.report.context.BaseAttributeBean.init(BaseAttributeBean.java:233)
at org.eclipse.birt.report.context.ViewerAttributeBean.<init>(ViewerAttributeBean.java:116)
at org.eclipse.birt.report.context.BirtContext.__init(BirtContext.java:44)
at org.eclipse.birt.report.context.BaseContext.<init>(BaseContext.java:69)
at org.eclipse.birt.report.context.BirtContext.<init>(BirtContext.java:30)
at org.eclipse.birt.report.servlet.ViewerServlet.__getContext(ViewerServlet.java:150)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doGet(BirtSoapMessageDispatcherServlet.java:151)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.eclipse.birt.report.filter.ViewerFilter.doFilter(ViewerFilter.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:169)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
1. Is it because of the file path having "" isntead of "/"?
2. Should we be using the relative path (start from the app-root), instead of the absolue path (starting from C:...)?
Thanks again
Rakesh
mailtorake
Jason,
I think, I figured it out; WORKING_FOLDER_ACCESS_ONLY set to true by default, is the culprit. I had to change it to false.
Since my documents folder is not inside the working folder (which is BIRT_VIEWER_WORKING_FOLDER=/Reports), it was not accessible.
Two solutions:
1. set that above flag to false.
2. set the documents folder under /Reports (ie. under BIRT_VIEWER_WORKING_FOLDER)
Thanks
Rakesh
mailtorake
Hi Jason,
One more thing that just struck me:
My report table has sub rows (under respective master rows), each of which is a drill down link.
Now the question is, how can I cache those sub rows?
What can I do while setting those drilldowns, so that 2nd access to that particular childRow will be faster?
The underlying rptdesign is same for all those sub rows.
Table
MasterRow1
----childRow1
----childRow2
----childRow3
----childRow4
MasterRow2
----childRow1
----childRow2
----childRow3
----childRow4
...etc
Note: In previous email posts of this thread, we were dealing with breadcrumb links which were at page level, but these childRows are drilldown links.
Appreciate your help a lot.
Thanks
Rakesh
JasonW
Rakesh,
on the document issue you can specify a partial url like /documents/myfolder/test.rptdocument. So in the example I provided you could parse the string to get the documents folder.
On the child issue. If none of the parameters have change by default the rptdocument should be used, so I am not certain what you need. You could always use a similar scheme to the one done earlier, just use a unique session variable.
Jason
mailtorake
Hi Jason,
Thanks once again!
I could resolve the document issue with either of those two options and I chose to set the documents folder in web.xml.
As per the child issue:
All those childs are generate by the drilldown link I had created in my report design and hence, birt has put in respective parameters in the onClick url for all those drill down links.
Following is just a simple example:
1. Url generated by birt for ChildRow1 under MasterRow1: <common-url-string>&id=1&value=1
2. Url generated by birt for ChildRow2 under MasterRow1: <common-url-string>&id=2&value=2
All these childs are generated by the drilldowns and there are many of them ( >50 at times).
Should I just keep storing all those documents in the session as soon as user keeps clicking them?
(or)
is there a better way to achieve the same while setting the drilldown link itself?
Thanks
Rakesh
JasonW
Rakesh,
I may still be missing something, but if the first time you run your level 1 report it generates this link:
Url generated by birt for ChildRow1 under MasterRow1: <common-url-string>&id=1&value=1
The next time you come back to level one using the crumb the report document should be used and the link should be the same. Is this not what you want?
Jason
mailtorake
Hi Jason,
Below is a tabular description of how my report looks:
Initial Master page. No Breadcrumbs
GrandParentName ParentName city state
GrandParent1 sjc ca
Parent1-link nyc ny
Parent2-link jc nj
parent3-link sfo ca
GrandParent2
Parent4-link kop pa
Parent5-link bo ma
Clicking on Parent1-link will take us to the following report
BreadCrumbForGrandParents
ParentName ChildName city state
Parent1 sjc ca
Child1-link nyc ny
Child2-link jc nj
Child3-link sfo ca
Child4-link kop pa
Child5-link bo ma
Similarly, I can drill 6 levels down. All those Parent-links and child-links are drilldown links and are generated by Birt (which document to drill to, is specified in my report design). All these links have different parameters in the url.
I'm trying to achieve caching, while going back and forth between the above two reports. Parent1-link, parent2-link etc are all generated by Birt (since they are drilldowns); If I have to click on Parent1-link once again(ie.I've already gone to 2nd report and came back to the initial report), it has to be faster.
Looks like, I may have to append the "&__document=<location-of-the-document>" to (to the url of parent1-link)the drill-down url generated by birt. Correct?
If so, is there an easy of doing it while defining the drilldown in the report design itself?
Thanks
Rakesh
JasonW
Rakesh,
___
Looks like, I may have to append the "&__document=<location-of-the-document>" to (to the url of parent1-link)the drill-down url generated by birt. Correct?
___
Yes. you can also in the design setup a drill to a report document instead of a report design, but in your case I do not think that is a good approach. One final thing you can also do is build your own hyperlink function using multiple Text elements with JavaScript embedded in script tags.
Jason
mailtorake
<blockquote class='ipsBlockquote' data-author="JasonW"><p>
___<br />
Looks like, I may have to append the "&__document=<location-of-the-document>" to (to the url of parent1-link)the drill-down url generated by birt. Correct?<br />
___<br /></p></blockquote>
Exactly!<br />
<br />
<blockquote class='ipsBlockquote' data-author="JasonW"><p>
Yes. you can also in the design setup a drill to a report document instead of a report design, but in your case I do not think that is a good approach.<br /></p></blockquote>
Agreed; it's not a good approach in my case.<br />
<br />
<blockquote class='ipsBlockquote' data-author="JasonW"><p>
One final thing you can also do is build your own hyperlink function using multiple Text elements with JavaScript embedded in script tags.<br /></p></blockquote>
I didn't quite get this; are you suggesting to replace those drill downs with hyperlink functionality?<br />
<br />
One thing that struck me couple of hrs back:<br />
1. Hold a map of the structure: {Key:DrillDownLink, value: reportDocument} in the session.<br />
2. When user hits a drill-down link, check if the link is present in the above map; if not, create an entry in the map.<br />
3. If the entry exists in the map, append the value to the key and redirect user to the newly formed url (which is cached already)<br />
<br />
The above approach seems possible, but I want to know where and how to do each of those steps. May be I should read more about the report life-cycle, after which I will be able to answer it myself; but, please let me know what you think.<br />
<br />
Thanks<br />
Rakesh
JasonW
Rakesh,
On the drill down replacement. You have the option to build your own hyperlinks. I am not suggesting you do it, just know its available.
Your new approach sounds very viable. Please let me know how it goes.
Jason
mailtorake
Jason,
The map will be present in the session. I will update in beforeFactory.
Now, let's say,
1. I'm on page1; by clicking on the drilldownlink link1, I go to page2.
2. I make an entry into the map at this moment.
3. Whenever I go back to page1, I am thinking of updating link1.
4. Looks like, onRender of the drilldown-cell (cell holding link1 in our case) is where I should be modifying that link.
I've been searching for examples that modify the cell data on render of the cell. Could you point me to some if you have come across such examples?
Thanks again
Rakesh
mailtorake
I think, I figured it out:
I can do something like the following in the onRender of the drilldown cell:
dt=this.action.getDrillThrough();
pb=dt.getParameterBindings();
pb.put("testing", "true");
dt.setParameterBindings(pb);
above logic is setting another query string parameter: &testing=true...
Similarly, I can set the &__document=<report-document-name>, after checking for its existence in the map I was talking about.
Rakesh