Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » var OR dynamic data set OR??(Variable Text in Chart and Table Report)
var OR dynamic data set OR?? [message #827131] Thu, 22 March 2012 23:35 Go to next message
Kris Tannar is currently offline Kris TannarFriend
Messages: 5
Registered: March 2012
Junior Member
Hi,
I am very new to BIRT and not sure how best to tackle what I need to do.
I need to take values entered in client and pass them to the server and subsequently the BIRT report.

I'm using a POJO:
public List<ReportRecord> getReportValues(String reportStartTime,
String reportEndTime)

{
List<ReportRecord> record = new ArrayList<ReportRecord>();
for (int i = 0; i < record.size(); i++)
{
ReportRecord reportRecord = new ReportRecord();
reportRecord.setReportStartTime(reportStartTime);
reportRecord.setReportEndTime(reportEndTime);
record.add(reportRecord);
}
return record;
}

My open script:
importPackage(Packages.com.reports.server);
count = 0;


// Create instance of
// the class

reportParams = new Packages.com.reports.server.ReportServiceImpl();
//Load the List

userParams = reportParams.getReportValues("Java", "Java");

My fetch:
if (count < userParams.size() )
{
var rtnString = userParams.get(count).getReportStart();
dataSetRow["Start Time:"] = rtnString;

var rtnStrng = userParams.get(count).getReportEndTime
dataSetRow["End Time:"] = rtnString;
count++;

return true;
}
return false;

My values make it to the server (tomcat) fine. However, the default value "Java" show up for both variable. Just to mention this, I am using two different data sets for the same report.

What am I missing?
Re: var OR dynamic data set OR?? [message #827622 is a reply to message #827131] Fri, 23 March 2012 15:26 Go to previous messageGo to next message
Kris Tannar is currently offline Kris TannarFriend
Messages: 5
Registered: March 2012
Junior Member
After a little more reading, I'm using the beforeOpen script for my var:

importPackage(Packages.com.reports.server);
count = 0;


// Create instance of
// the class

reportParams = new Packages.com.reports.server.ReportServiceImpl();
//Load the List

userParams = reportParams.getReportValues("Java");

if (count < userParams.size() )
{
var rtnString = userParams.get(count).getReportStart();
dataSetRow["Start Time:"] = rtnString;

var rtnStrng = userParams.get(count).getReportEndTime
dataSetRow["End Time:"] = rtnString;
count++;

return true;
}
return false;


However, the var data is still not being passed to the report.
Any ideas?
Thanks!
Re: var OR dynamic data set OR?? [message #827626 is a reply to message #827622] Fri, 23 March 2012 15:32 Go to previous messageGo to next message
Kris Tannar is currently offline Kris TannarFriend
Messages: 5
Registered: March 2012
Junior Member
Just a bit more about instance of BIRT:
BIRT Engine ver 3.7.2 is installed in a servlet
Re: var OR dynamic data set OR?? [message #827746 is a reply to message #827131] Fri, 23 March 2012 18:47 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

The fetch method is only called once per data set row. Generally you
set up an iterator in the open and use the iterator in the fetch. In
your case is userParams one row of data or multiple rows?

Jason


On 3/22/2012 7:35 PM, Kris Tannar wrote:
> Hi,
> I am very new to BIRT and not sure how best to tackle what I need to do.
> I need to take values entered in client and pass them to the server and
> subsequently the BIRT report.
>
> I'm using a POJO:
> public List<ReportRecord> getReportValues(String reportStartTime, String
> reportEndTime)
>
> {
> List<ReportRecord> record = new ArrayList<ReportRecord>();
> for (int i = 0; i < record.size(); i++)
> {
> ReportRecord reportRecord = new ReportRecord();
> reportRecord.setReportStartTime(reportStartTime);
> reportRecord.setReportEndTime(reportEndTime);
> record.add(reportRecord);
> }
> return record;
> }
>
> My open script:
> importPackage(Packages.com.reports.server);
> count = 0;
>
>
> // Create instance of
> // the class
>
> reportParams = new Packages.com.reports.server.ReportServiceImpl();
> //Load the List
>
> userParams = reportParams.getReportValues("Java", "Java");
> My fetch:
> if (count < userParams.size() )
> {
> var rtnString = userParams.get(count).getReportStart();
> dataSetRow["Start Time:"] = rtnString;
> var rtnStrng = userParams.get(count).getReportEndTime
> dataSetRow["End Time:"] = rtnString; count++;
>
> return true;
> }
> return false;
>
> My values make it to the server (tomcat) fine. However, the default
> value "Java" show up for both variable. Just to mention this, I am using
> two different data sets for the same report.
>
> What am I missing?
Re: var OR dynamic data set OR?? [message #827754 is a reply to message #827622] Fri, 23 March 2012 18:56 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Move this to the open:
userParams = reportParams.getReportValues("Java");


Then in the fetch use:
if (count < userParams.size() )
{
var rowdata = userParams.get(count);

importPackage( Packages.java.io );
out = new PrintWriter( new FileWriter( "c:/temp/fetchevents.txt", true ) );
out.println( "row data " + rowdata);
out.println( "firstCol " + rowdata.getReportStart());

out.close();

var rtnString = rowdata.getReportStart();
dataSetRow["Start Time:"] = rtnString;
var rtnStrng = rowdata.getReportEndTime
dataSetRow["End Time:"] = rtnString;
count++;

return true;
}
return false;

Then take a look at the text file that is generated.

Jason

On 3/23/2012 11:26 AM, Kris Tannar wrote:
> After a little more reading, I'm using the beforeOpen script for my var:
>
> importPackage(Packages.com.reports.server);
> count = 0;
>
>
> // Create instance of
> // the class
>
> reportParams = new Packages.com.reports.server.ReportServiceImpl();
> //Load the List
>
> userParams = reportParams.getReportValues("Java");
> if (count < userParams.size() )
> {
> var rtnString = userParams.get(count).getReportStart();
> dataSetRow["Start Time:"] = rtnString;
>
> var rtnStrng = userParams.get(count).getReportEndTime
> dataSetRow["End Time:"] = rtnString;
> count++;
>
> return true;
> }
> return false;
>
>
> However, the var data is still not being passed to the report.
> Any ideas?
> Thanks!
Re: var OR dynamic data set OR?? [message #827849 is a reply to message #827754] Fri, 23 March 2012 21:49 Go to previous messageGo to next message
Kris Tannar is currently offline Kris TannarFriend
Messages: 5
Registered: March 2012
Junior Member
Hi Jason,
Thanks for the response.

userParams will be multiple rows of data.

In the open script:
userParams = reportParams.getReportValues("Java", "Java", "Java");

Which matches the method signature.

the fetch script:
if (count < userParams.size() )
{
var rowdata = userParams.get(count);

importPackage( Packages.java.io );
out = new PrintWriter( new FileWriter( "c:/temp/fetchevents.txt", true ) );
out.println( "row data " + rowdata);
out.println( "firstCol " + rowdata.getReportStartTime());
out.println( "secordCol " + rowdata.getReportEndTime());
out.println( "thirdCol " + rowdata.getEndUser());

out.close();

var rtnString = rowdata.getEndUser();
dataSetRow["End User:"] = rtnString;

var rtnString = rowdata.getReportStartTime();
dataSetRow["Start Time:"] = rtnString;
var rtnStrng = rowdata.getReportEndTime();
dataSetRow["End Time:"] = rtnString;

count++;

return true;
}
return false;

When I examine the out file all cols have "Java" as the value. The output on the report shows "Java" as well.

I am using two different data sets to populate the same report; could that be an issue?

Thanks for your time.
Re: var OR dynamic data set OR?? [message #829616 is a reply to message #827849] Mon, 26 March 2012 14:57 Go to previous messageGo to next message
Kris Tannar is currently offline Kris TannarFriend
Messages: 5
Registered: March 2012
Junior Member
Hi Jason,
Went through another iteration making the changes you suggested; please see the open and fetch scripts below:

open:
importPackage(Packages.com.reports.server);
count = 0;

// Create instance of
// Service class

reportParams = new Packages.com.reports.server.ReportServiceImpl();
//Load the List

userParams = reportParams.getReportValues("Java");


fetch:
if (count < userParams.size() )
{
var rowdata = userParams.get(count);

importPackage( Packages.java.io );
out = new PrintWriter( new FileWriter( "c:/temp/Newfetchevents.txt", true ) );
out.println( "row data " + rowdata);
out.println( "firstCol " + rowdata.getEndUser());
out.println( "secondCol " + rowdata.getReportStartTime());
out.println( "ThirdCol " + rowdata.getReportEndTime());
out.close();

var rtnString = rowdata.getEndUser();
dataSetRow["End User:"] = rtnString;

var rtnString = rowdata.getReportStartTime();
dataSetRow["Start Time:"] = rtnString;

var rtnString = rowdata.getReportEndTime();
dataSetRow["End Time:"] = rtnString;

count++;

return true;
}
return false;

However, I receive a BIRT error:
"Can't find method com.reports.server.ReportServiceImpl.getReportValues(string)" from the open script.
This is understandable because the method signature in the script does not match the getReportValues(string, string string) signature.

Can't seem to build my scripts properly to retrieve data from the user, place it into the report design at run time.
What am I missing?
Any help would be super appreciated!!

Re: var OR dynamic data set OR?? [message #830743 is a reply to message #829616] Wed, 28 March 2012 02:26 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

What do you get when you change:

userParams = reportParams.getReportValues("Java");
to

userParams = reportParams.getReportValues("Java", "Java", "Java");

Jason

On 3/26/2012 10:57 AM, Kris Tannar wrote:
> Hi Jason,
> Went through another iteration making the changes you suggested; please
> see the open and fetch scripts below:
>
> open:
> importPackage(Packages.com.reports.server);
> count = 0;
>
> // Create instance of
> // Service class
>
> reportParams = new Packages.com.reports.server.ReportServiceImpl();
> //Load the List
>
> userParams = reportParams.getReportValues("Java");
>
>
> fetch:
> if (count < userParams.size() )
> {
> var rowdata = userParams.get(count);
>
> importPackage( Packages.java.io );
> out = new PrintWriter( new FileWriter( "c:/temp/Newfetchevents.txt",
> true ) );
> out.println( "row data " + rowdata);
> out.println( "firstCol " + rowdata.getEndUser());
> out.println( "secondCol " + rowdata.getReportStartTime());
> out.println( "ThirdCol " + rowdata.getReportEndTime());
> out.close();
>
> var rtnString = rowdata.getEndUser();
> dataSetRow["End User:"] = rtnString;
>
> var rtnString = rowdata.getReportStartTime();
> dataSetRow["Start Time:"] = rtnString;
>
> var rtnString = rowdata.getReportEndTime();
> dataSetRow["End Time:"] = rtnString;
>
> count++;
>
> return true;
> }
> return false;
>
> However, I receive a BIRT error:
> "Can't find method
> com.reports.server.ReportServiceImpl.getReportValues(string)" from the
> open script.
> This is understandable because the method signature in the script does
> not match the getReportValues(string, string string) signature.
>
> Can't seem to build my scripts properly to retrieve data from the user,
> place it into the report design at run time. What am I missing?
> Any help would be super appreciated!!
>
>
Previous Topic:Using jQuery UI in a report
Next Topic:out of memory error
Goto Forum:
  


Current Time: Sat Dec 20 10:40:03 GMT 2014

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

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