Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Refresh a report
Refresh a report [message #987471] Mon, 26 November 2012 17:57 Go to next message
nlajka - is currently offline nlajka -Friend
Messages: 61
Registered: April 2011
Member
Hello,

I am using Jason's tip to make a report that has parameters refresh. I would embed code below into a text object and make it formatted as HTML:
________________________________________________________________________________
<form name="input" onSubmit="return reloadPage();">
<script type="text/javascript">
function reloadPage() {
//alert("Reload time");
var temp = new String(location.href);
var targetURL = new String();
if(temp.indexOf("__overwrite=") != -1 ){
targetURL = temp.substring(0, temp.indexOf("&__overwrite") -1);
}else{
targetURL = temp;
}
targetURL += "&__overwrite=true";
//alert( targetURL );
location.replace(targetURL);
return false;
}
timer=setTimeout('reloadPage()', 5000);
</script>
</form>
___________________________________________________________________________________

It would refresh fine when I do a preview in the Designer.

However, when I try to run it into a web-viewer it would ask me for parameters. I've seen that parameters should be provided into url, but I don't understand where. Should it be added into quotes in the script above: targetURL += "&__overwrite=true";

Example1: targetURL += "&__overwrite=true&%22AuctionID%22=params["AuctionID"].value";

or somewhere else?
We are approaching our reports through following format:

https://birt.DOMAINNAME.com/reportname

When I try to access it on the server it shows up OK, I can put initial parameter values and it would bring data OK, but when it should refresh (in this case after 5 seconds) it just gives mi an error:

___________________________________________________________________________
- The report file : /var/lib/tomcat6/webapps/birt-viewer/ReportName does not exist or contains errors.

org.eclipse.birt.report.exception.ViewerException: The report file : /var/lib/tomcat6/webapps/birt-viewer/ReportName does not exist or contains errors. at org.eclipse.birt.report.context.ViewerAttributeBean.getDesignHandle(ViewerAttributeBean.java:647) at org.eclipse.birt.report.context.ViewerAttributeBean.__init(ViewerAttributeBean.java:224) at org.eclipse.birt.report.context.BaseAttributeBean.init(BaseAttributeBean.java:233) at org.eclipse.birt.report.context.ViewerAttributeBean.<init>(ViewerAttributeBean.java:118) 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:617) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 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.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) 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:293) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:776) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:705) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690) at java.lang.Thread.run(Thread.java:636)
___________________________________________________________________________________

Should the format be something like this:

https://birt.DOMAINNAME.com/reportname&__overwrite=true&%22AuctionID%22=params["AuctionID"].value
or just leave it in the script embeded in a format like in the example1.

I tried all of these combinations and none of them worked.

Thank you for your help.
Re: Refresh a report [message #987507 is a reply to message #987471] Mon, 26 November 2012 22:28 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Try something like the following:

<form name="input" onSubmit="return reloadPage();">
<script type="text/javascript">
function reloadPage() {
//alert("Reload time");
var temp = new String(location.href);
var targetURL = new String();
if(temp.indexOf("__overwrite=") != -1 ){
targetURL = temp.substring(0, temp.indexOf("&__overwrite") -1);
}else{
targetURL = temp;
}
targetURL += "&__overwrite=true&MyParameter="+<value-of>6</value-of>;
//alert( targetURL );
location.replace(targetURL);
return false;
}
timer=setTimeout('reloadPage()', 5000);
</script>
</form>

Note that the value of value should I suppose come from your row data.

Jason
Re: Refresh a report [message #987518 is a reply to message #987507] Mon, 26 November 2012 23:00 Go to previous messageGo to next message
nlajka - is currently offline nlajka -Friend
Messages: 61
Registered: April 2011
Member
No luck. I don't have row data as an option to put into text element expression builder at all. All there is Report Parameter, Native JavaScript Functions, BIRT Functions and Operators.

How about multiple parameters too?
Re: Refresh a report [message #987519 is a reply to message #987518] Mon, 26 November 2012 23:02 Go to previous messageGo to next message
nlajka - is currently offline nlajka -Friend
Messages: 61
Registered: April 2011
Member
We would like user to open the report for the first time with certain values in the parameter and after that user should be able to leave it open in the web browser to refresh by itself with same values he chose the first time.
Re: Refresh a report [message #987524 is a reply to message #987519] Mon, 26 November 2012 23:40 Go to previous messageGo to next message
nlajka - is currently offline nlajka -Friend
Messages: 61
Registered: April 2011
Member
This is how I understood that this url line should look like:
targetURL += "&__overwrite=true&Param1="+<value-of>557</value-of>+"&Param2"+<value-of>558</value-of>+"&Param3"+<value-of>559</value-of>+"&Param4"+<value-of>1010</value-of>;

where 557, 558,559 and 1010 are their ID numbers.

However this is not working either. I can run the report but it would not prompt me now with parameter box at the time for refresh to occur. It would just sit like there is no refresh in at all.
Re: Refresh a report [message #987530 is a reply to message #987524] Tue, 27 November 2012 00:41 Go to previous messageGo to next message
nlajka - is currently offline nlajka -Friend
Messages: 61
Registered: April 2011
Member
I've created another report with just two parameters but than I added two data fields that would get parameter value. After that I would their values into url but it would prompt me for parameter values when the refresh occurs (in the birt-viewer). If I run it in the designer it would execute OK.

Why would it work fine in designer and not in the viewer?

Thank you for your help.

[Updated on: Tue, 27 November 2012 00:45]

Report message to a moderator

Re: Refresh a report [message #988434 is a reply to message #987530] Thu, 29 November 2012 21:27 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Is that a sample I can run? If you just want to hard code the values just add them directly in the string:
targetURL += "&__overwrite=true&MyParameter=6&MyParameter2=3";

Jason
Re: Refresh a report [message #988449 is a reply to message #988434] Thu, 29 November 2012 22:17 Go to previous messageGo to next message
nlajka - is currently offline nlajka -Friend
Messages: 61
Registered: April 2011
Member
Hello Jason,

thank you for replying. I pretty much gave up on autorefresh. I am getting so many errors that I don't know where to begin.

I changed now to the label that should contain a hyperlink which should be "clickable" by a user. So they should be able to click it when they want it.
Requirement is still the same. On click report should refresh with the same parameter values with no need for parameter values to be repeated in an parameter box. No hard-coded values at all. The latest exception I got is:
"
org.eclipse.birt.report.service.api.ReportServiceException: Error happened while running the report.
"
I've checked value type in the parameter and procedure which is being called and at the both places type is int.

This is how the link looks like:

https://birt.DOMAINNAME.com/MyReport?__overwrite=true&Parameter1=<VALUE-OF>params["Parameter1"]</VALUE-OF>&Parameter2=<VALUE-OF>params["Parameter2"]</VALUE-OF>

What puzzles me is that when I check this link in javascript Expression Builderit tells me that there is an error and points towards ":" just after "https" as a wrong element in the link. When I remove "semicolon" out of the link it tells me that it is ok, but then it doesn't work as a hyperlink.

I would appreciate help a lot.

Once again,

Thank you.

[Updated on: Thu, 29 November 2012 22:21]

Report message to a moderator

Re: Refresh a report [message #988512 is a reply to message #988449] Fri, 30 November 2012 10:16 Go to previous message
nlajka - is currently offline nlajka -Friend
Messages: 61
Registered: April 2011
Member
I got it. Now it is working fine.

It was the format, I had to add " before http://.... so literary it had to look like this:

"https://birt.DOMAINNAME.com/reportname?__overwrite=true&Param1="+params["Param1"].value+"&Param2="+params["Param2"].value


I can imagine how I sounded to you guys Very Happy

Jason, thanks again for your guidance, this world wouldn't turn around without you!
Previous Topic:Scrollbars or cuts or no charts with various browsers
Next Topic:Meter Chart - Set regions at runtime from Series data
Goto Forum:
  


Current Time: Fri Dec 19 07:24:13 GMT 2014

Powered by FUDForum. Page generated in 0.03693 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software