Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » session attributes as report parameter - Need help urgent
session attributes as report parameter - Need help urgent [message #244061] Thu, 21 June 2007 18:41 Go to next message
Eclipse UserFriend
Originally posted by: krishna.k.kondraguntla.jpmchase.com

Hi,

I have used a scripted data source to get data into BIRT report. I have
also created a report parameter (as combo box) to pass information to a
java function to get the data back. Now I have to get values for combo box
(report parameter) from a Http session. I did get values from Http session
and displayed in the report but I could not get them into parameter combo
box. Please let me know if this is possible. I will paste sample code I am
using.

********************beforeFactory*************************** ***********
// Request Attributes
var request = reportContext.getHttpServletRequest();
// Session Attributes
var session = request.getSession();
// Insert a variable on the session
var myStr = new Array(5);
myStr[0] = "93839";
myStr[1] = "998232";
myStr[2] = "8242892";
myStr[3] = "2384932";
myStr[4] = "994892";
session.setAttribute("ReportAttribute", myStr);
var result = session.getAttribute("ReportAttribute");
// Store top map as a global
reportContext.setPersistentGlobalVariable("topMap", result);

*********************open*********************************** *************
aString = reportContext.getPersistentGlobalVariable("topMap");
cnt = 0;
total = aString.length;

*********************fetch********************************** **************
if(cnt < total) {
row["Ccenter"] = aString[cnt];
cnt++;
return true;
}
return false;
Re: session attributes as report parameter - Need help urgent [message #244376 is a reply to message #244061] Fri, 22 June 2007 16:51 Go to previous message
Eclipse UserFriend
Originally posted by: jasonweathersby.alltel.net

Krishna,

Can you try entering this for your scripted ds

open -

cnt = 0;
//total = aString.length;

// Request Attributes
var request = reportContext.getHttpServletRequest();
// Session Attributes
var session = request.getSession();
// Insert a variable on the session
var myStr = new Array(5);
myStr[0] = "93839";
myStr[1] = "998232";
myStr[2] = "8242892";
myStr[3] = "2384932";
myStr[4] = "994892";
session.setAttribute("ReportAttribute", myStr);
result = session.getAttribute("ReportAttribute");

total = result.length;

fetch -

if(cnt < total) {
row["Ccenter"] = result[cnt];
cnt++;
return true;
}
return false;

Do not enter anything in the beforeFactory, because your data set is
being called before the beforeFactory because it is tied to a parameter.

Jason



Krishna wrote:
> Hi,
>
> I have used a scripted data source to get data into BIRT report. I have
> also created a report parameter (as combo box) to pass information to a
> java function to get the data back. Now I have to get values for combo
> box (report parameter) from a Http session. I did get values from Http
> session and displayed in the report but I could not get them into
> parameter combo box. Please let me know if this is possible. I will
> paste sample code I am using.
>
> ********************beforeFactory*************************** ***********
> // Request Attributes
> var request = reportContext.getHttpServletRequest();
> // Session Attributes
> var session = request.getSession();
> // Insert a variable on the session
> var myStr = new Array(5);
> myStr[0] = "93839";
> myStr[1] = "998232";
> myStr[2] = "8242892";
> myStr[3] = "2384932";
> myStr[4] = "994892"; session.setAttribute("ReportAttribute", myStr);
> var result = session.getAttribute("ReportAttribute");
> // Store top map as a global
> reportContext.setPersistentGlobalVariable("topMap", result);
>
> *********************open*********************************** *************
> aString = reportContext.getPersistentGlobalVariable("topMap");
> cnt = 0;
> total = aString.length;
>
> *********************fetch********************************** **************
> if(cnt < total) {
> row["Ccenter"] = aString[cnt];
> cnt++;
> return true;
> }
> return false;
>
Previous Topic:Need advice on Linked Subreports
Next Topic:Any facilities/strategies for tree displays in Birt reports?
Goto Forum:
  


Current Time: Tue Apr 16 06:12:30 GMT 2024

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

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

Back to the top