Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
getDefaultValue list and rptdesign
Migrateduser
<p>All of our reports are accessed via the Birt Viewer and they have these two hidden, but required parameters:</p><p> </p><p>pUserName</p><p>pPassword</p><p> </p><p>Since the initial entry into the reports is a post from a web application, we can ensure that those two parameters are passed to the initial report. However, when we want to do a drill through to another report, we either need to pass those parameters as URL variables (via the hyperlink parameters screen) or, as I have done, set session variables to hold those values and then retrieve them as default values later. To do this, I have put this script in the parameter validate event:</p><div><pre class="_prettyXprint">importPackage( Packages.javax.servlet.http);var request = reportContext.getHttpServletRequest();var session = request.getSession();session.setAttribute("pUserName", params["pUserName"].value);true;</pre><p>This sets the session attribute pUserName to be the value of the pUserName parameter. So when drilling into another report, or even viewing another report later, I would like to not have to pass or ask for these parameters again, so in the getDefaultValueList event of the same parameter I have this code:</p><div><pre class="_prettyXprint">importPackage( Packages.javax.servlet.http);var request = reportContext.getHttpServletRequest();var session = request.getSession();session.getAttribute("pUserName");</pre></div><p>This sets the default value of the pUserName parameter to the value of whatever is in the session attribute of the same name.</p><p> </p><p>This works great when the report is running on Tomcat using the Birt Viewer.</p><p> </p><p>====</p><p>Now, here is my problem. Since the pUserName parameter is hidden and required (by design) and sessions don't really exist in the eclipse Birt designer, when I click 'View Report' from eclipse I always get an error indicating that pUserName isn't set.</p></div><p> </p><p>If I go into the report design, and Edit the Parameter, I can set its default value. However, this appears to be overridden by what is returned from the getDefaultValueList event.</p><p> </p><p>My question is this, is there some way in the getDefaultValueList event to check if the parameter default value was explicitly set in the report design before I set it to the value of the session attribute?</p>
Find more posts tagged with
Comments
There are no comments yet