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)
Passing parameters through URL
devp
Hi<br />
I am using Actuate iServer Express and have reached a roadblock. I would appreciate any help.<br />
<br />
I have a cascading parameter group, where the first parameter to be populated depends on the userid of the user accessing the report. To get the parameter list populated, I created a dataset and attatched an eventhandler to it, so that I could change the query at the 'beforeOpen' event. The idea was to pass the user id through the request. But unfortunately when I do the following:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
reportContext.getHttpServletRequest();
</pre>
I always get a null as the return value. How can I pass the user id ?<br />
This is urgent, please help.<br />
<br />
Thanks and Best Regards<br />
devp
Find more posts tagged with
Comments
devp
I am using iServer Version: 9 Service Pack 3 Fix 3A (Build 90F080509). Is this a bug? Are there any known workarounds?
Thanks
devp
rmurphy
The iServer Express always passes the logged in user to the reportContext in the ServerUserName variable. The following DevShare entry shows how to get the value from the variable and alter the query in the Data Set's beforeOpen event.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/devshare/designing-birt-reports/122-filter-birt-jdbc-query/'>Filter
BIRT JDBC Query - Designs & Code - BIRT Exchange</a><br />
<br />
Rob
devp
Hi Rob
Thank you for the reply. I was able to pass the userid using that technique.
But the other query is, this way I can only pass the user id. If it is required to pass other parameters how do I achieve that?
Also why does getHttpServletRequest always return null? Is this the way it is supposed to work? Some of my design decisions will depend on the answer to that.
Thanks again.
devp
rmurphy
When using the iServer Express, report requests are sent over a web service call. Since you can use these web services directly you are not guaranteed to have a HttpServletRequest. Therefore, you are better suited to pass other values into the report using parameters. If you use hidden parameters, the user will not be prompted for them. Here is an example of a URL passing a parameter to the report design:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>http://localhost:8900/iportal/executereport.do?__executablename=/PathToReport/ReportName.rptdesign&MyParam=ParamValue&invokesubmit=true</pre>
<br />
It is expected behavior for the HttpServletRequest object to be null.<br />
<br />
Rob
devp
Hi Rob
Thanks again for the clarification. I do want the user to select the parameters but for the first query in the cascaded parameter. In effect I want users to select/set some parameters and want to set some other parameters automatically. In the present scenario it is 'all or nothing'. Is there a workaround?
Thanks
devp
devp
<blockquote class='ipsBlockquote' data-author="rmurphy"><p>When using the iServer Express, report requests are sent over a web service call. Since you can use these web services directly you are not guaranteed to have a HttpServletRequest. <br />
<br />
<br />
It is expected behavior for the HttpServletRequest object to be null.<br />
<br />
Rob</p></blockquote>
<br />
Hi Rob,<br />
I did not quite understand the argument put here. Can you please calrify a bit more? What is the reason the function <br />
<pre class='_prettyXprint _lang-auto _linenums:0'>reportContext.getHttpServletRequest()</pre> exist? To interact with the users' session?<br />
<br />
Thanks<br />
devp
rmurphy
In cases where you are using the BIRT Engine and setting the PlatformContext to use a ServletContext you will have access to the HttpServletRequest.
Since the iServer Exposes itself via web services that could be called from virtually any type of application, the Platform that is started up inside the iServer Express is likely not started using a ServletContext and therefore the HttpServletContext is not exposed.
Rob
devp
Thanks for the explanation Rob.
Best Regards
devp
arielcamus
Hi devp,
I think it will be to late to answer your question. But it's maybe not to late for other people.
The problem is Java doesn't include javax.servlet into the API. So, you have to download the library and include it into your build PATH.
I'm currently using Maven, so I just have to run "Add dependency" or include a new dependency in my project pom file.
Anyway, after including the library javax.servlet, just upcast the object resulting of calling "reportContext.getHttpServletRequest();".
Do it this way:
HttpServletRequest request = (HttpServletRequest) reportContext.getHttpServletRequest();
After that, you can work with the HttpServletRequest object calling its getQueryString() or every other HttpServletRequest method.
i.e. String request = request.getQueryString());
I've spent few hours until I got the answer. I hope it will help you.
neetira
<blockquote class='ipsBlockquote' data-author="arielcamus"><p>Hi devp,<br />
<br />
I think it will be to late to answer your question. But it's maybe not to late for other people.<br />
<br />
The problem is Java doesn't include javax.servlet into the API. So, you have to download the library and include it into your build PATH.<br />
<br />
I'm currently using Maven, so I just have to run "Add dependency" or include a new dependency in my project pom file.<br />
<br />
Anyway, after including the library javax.servlet, just upcast the object resulting of calling "reportContext.getHttpServletRequest();". <br />
<br />
Do it this way:<br />
<br />
HttpServletRequest request = (HttpServletRequest) reportContext.getHttpServletRequest();<br />
<br />
After that, you can work with the HttpServletRequest object calling its getQueryString() or every other HttpServletRequest method.<br />
<br />
i.e. String request = request.getQueryString());<br />
<br />
<br />
I've spent few hours until I got the answer. I hope it will help you.</p></blockquote>
<br />
Hi arielcamus,<br />
<br />
I am trying the same in MyEclipse BIRT Report. when I tried the following statement: <br />
HttpServletRequest request = (HttpServletRequest) reportContext.getHttpServletRequest();<br />
<br />
I got an error that "Missing ; before statement" after HttpServletRequest request<br />
<br />
if i put <br />
var request = (HttpServletRequest) reportContext.getHttpServletRequest();<br />
<br />
I get the same error at a different place - after reportContext<br />
<br />
only if I put <br />
var request= reportContext.getHttpServletRequest();<br />
<br />
there is no error but the value is null...<br />
<br />
is there some other way out?<br />
<br />
neeti
sonimanish
Thanks for solutions,<br />
<br />
But when am trying this link in my application. it throw me on iserver express login page.<br />
Once i logged in link redirected to report.<br />
<br />
i want to avoid this login screen my writing some code in code behind.<br />
please guid me how.<br />
<br />
<br />
please mail me solutions on my mail id<br />
<br />
Thanks <br />
manish soni<br />
<a href='mailto:' title='E-mail Link' class='bbc_email'>manuroshan2003@yahoo.co.in</a><br />
india