Skip to main content



      Home
Home » Archived » BIRT » Reporting POJO attributes
Reporting POJO attributes [message #85852] Mon, 31 October 2005 13:59 Go to next message
Eclipse UserFriend
Originally posted by: mlorenz.nc.rr.com

I have been through the basic tutorial and I am aware of the (relatively)
new Hibernate and BIRT article. However, I have not seen much in the way
of working with POJO's in my model layer. Almost everything centers around
iterating over rows from a DB.

My application has some iteration, but most of what I have to report on
for our most important report is lots of attributes of the target object
and closely associated objects. There is very little iteration.

Can anyone walk me through an example or point me to a URL that details
how to do this?

Thanks so much - I am trying to get our projects to move to BIRT, but if I
can't get this resolved...

Mark
Re: Reporting POJO attributes [message #85898 is a reply to message #85852] Mon, 31 October 2005 15:31 Go to previous messageGo to next message
Eclipse UserFriend
Mark,

Most of the examples you will find of accessing a POJO do iterate over a row
concept.
That said, you definately can have just one "Row" with each column beign a
seperate call to some external class. If you can give me an example of what
your are trying to do, I probably can help.

Jaso Weathersby
BIRT PMC


"Mark Lorenz" <mlorenz@nc.rr.com> wrote in message
news:606b47434edbae1373deb1ee0be039d5$1@www.eclipse.org...
>I have been through the basic tutorial and I am aware of the (relatively)
>new Hibernate and BIRT article. However, I have not seen much in the way of
>working with POJO's in my model layer. Almost everything centers around
>iterating over rows from a DB.
>
> My application has some iteration, but most of what I have to report on
> for our most important report is lots of attributes of the target object
> and closely associated objects. There is very little iteration.
>
> Can anyone walk me through an example or point me to a URL that details
> how to do this?
>
> Thanks so much - I am trying to get our projects to move to BIRT, but if I
> can't get this resolved...
>
> Mark
>
Re: Reporting POJO attributes [message #85912 is a reply to message #85852] Mon, 31 October 2005 15:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mlorenz.nc.rr.com

Specifically, how do I get a String, e.g., to display on the report? I
see that I have "row[xxx]", but if a value is not in a row but is just an
attribute value, what is the syntax to output it?

Thx, Mark
Re: Reporting POJO attributes [message #85926 is a reply to message #85912] Mon, 31 October 2005 15:52 Go to previous messageGo to next message
Eclipse UserFriend
Mark,

Lets say you have a class called TestClass;
Lets say it has a method call getMyString();
If you put a data control on the canvas and double click on it to bring up
the expression builder you can put the following code to print that string.

clsInst = new Packages.mypackagename.TestClass();
clsInst.getMyString();

Whatever is the last value is the one that is displayed. You can also use
if then syntax.
Hope this helps.

Jason Weathersby
BIRT PMC


"Mark Lorenz" <mlorenz@nc.rr.com> wrote in message
news:2847a0df16e0b03861c13b46f659abb4$1@www.eclipse.org...
> Specifically, how do I get a String, e.g., to display on the report? I
> see that I have "row[xxx]", but if a value is not in a row but is just an
> attribute value, what is the syntax to output it?
>
> Thx, Mark
>
Re: Reporting POJO attributes [message #85940 is a reply to message #85898] Mon, 31 October 2005 16:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mlorenz.nc.rr.com

Thanks Jason. I have a .jar file in the classes directory under the
viewer. It has code like this (simplistic example):
===============
package com.labcorp.cels.pla.domain.organization;

/**
* Singleton for the entire corporation.
*/
public class LabCorp {
public static LabCorp INSTANCE = new LabCorp();
protected static String name = "LabCorp";

public static void main(String[] args) {

}
public static String getName() {
return name;
}
}
===============
I am merely trying to show the result of getName() on my report. I
created a dataset with coName as an output column of type String. I put a
Data item onto the report and tried various ways to get it to display.
Some scripts:

report beforeOpenDoc:
importPackage(Packages.com.labcorp.cels.pla.domain.organizat ion);
labCorp = LabCorp.INSTANCE;

report afterCloseDoc:
labCorp = null;

data onCreate:
labCorp.getName() + " Results Report";

and I get:
+ There are error(s) in Data:reportName
===============
My datasource is a scripted datasource and I have a dataset with an output
column named corpName of type String.

Any idea what I'm doing wrong?

Thanks for your help!
Mark
Re: Reporting POJO attributes [message #85956 is a reply to message #85940] Mon, 31 October 2005 16:37 Go to previous messageGo to next message
Eclipse UserFriend
Mark,

To do this doesnt require a Scripted Data Source.
I am attaching an example report that has one data control that calls the
class.
I reproduced the class, but I didnt put it in a package.
Remember to include the .class file in the classes folder under the viewer
web-inf/classes directory.

Jason Weathersby
BIRT PMC

"Mark Lorenz" <mlorenz@nc.rr.com> wrote in message
news:a36d9ab0c2d6429c933f0edc78743df1$1@www.eclipse.org...
> Thanks Jason. I have a .jar file in the classes directory under the
> viewer. It has code like this (simplistic example):
> ===============
> package com.labcorp.cels.pla.domain.organization;
>
> /**
> * Singleton for the entire corporation.
> */
> public class LabCorp {
> public static LabCorp INSTANCE = new LabCorp();
> protected static String name = "LabCorp";
>
> public static void main(String[] args) {
>
> }
> public static String getName() {
> return name;
> }
> }
> ===============
> I am merely trying to show the result of getName() on my report. I
> created a dataset with coName as an output column of type String. I put a
> Data item onto the report and tried various ways to get it to display.
> Some scripts:
>
> report beforeOpenDoc:
> importPackage(Packages.com.labcorp.cels.pla.domain.organizat ion);
> labCorp = LabCorp.INSTANCE;
>
> report afterCloseDoc:
> labCorp = null;
>
> data onCreate:
> labCorp.getName() + " Results Report";
>
> and I get:
> + There are error(s) in Data:reportName
> ===============
> My datasource is a scripted datasource and I have a dataset with an output
> column named corpName of type String.
>
> Any idea what I'm doing wrong?
>
> Thanks for your help!
> Mark
>
>




Re: Reporting POJO attributes [message #86033 is a reply to message #85926] Tue, 01 November 2005 08:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mlorenz.nc.rr.com

Thanks for the reply Jason. I had tried that, so I think the problem must
be that it is not finding the class. I put a .jar file with the .class
file in it in
...\org.eclipse.birt.report.viewer_1.0.1\birt\WEB-INF\classe s.

Is there something I have to do to make BIRT look in this .jar file?
Do I have to tell Eclipse anything? (I do have a .jardesc file for the
jar)

And when I'm ready for production, do I just deploy to a .war as I
normally would?

Thanks again for your help.
Mark
Re: Reporting POJO attributes [message #86047 is a reply to message #85956] Tue, 01 November 2005 08:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mlorenz.nc.rr.com

Thanks for the reply! Sorry for my ignorance, but is there an IE setting
or tool to use to be able to convert the attachments to something useful?
I'm seeing:

begin 666 LabCorp.rptdesign
M/#]X;6P@=F5R<VEO;CTB,2XP(B!E;F-O9&EN9STB551&+3@B/SX-"CPA+2T@
M5W)I='1E;B!B>2!%8VQI< ...

How do I use this?

Thanks, Mark
Re: Reporting POJO attributes [message #86062 is a reply to message #86033] Tue, 01 November 2005 08:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mlorenz.nc.rr.com

Just for further info, here's the full error reported on Preview:

There are errors on the report page:
- There are error(s) in Grid:null
Error0 : data.engine.JSScriptInvalid(1 time)detail: Invalid Javascript
expression. Source: DataSet:LabCorp.fetch, line: 0,
Expression:function_prefix_1130849946059();function
function_prefix_1130849946059(){return false; //no rows, just
attributes}Script engine error: missing } after function body- There are
error(s) in Data:null
Error0 : data.engine.JSScriptInvalid(1 time)detail: Invalid Javascript
expression. Source: DataSet:LabCorp.fetch, line: 0,
Expression:function_prefix_1130849946060();function
function_prefix_1130849946060(){return false; //no rows, just
attributes}Script engine error: missing } after function bodyError1 :
Failed to evaluate labCorp.getName() + " Results Report"(1 time)detail:
Failed to evaluate labCorp.getName() + " Results Report"TypeError: getName
is not a function. (#1)
Re: Reporting POJO attributes [message #86077 is a reply to message #86062] Tue, 01 November 2005 09:35 Go to previous messageGo to next message
Eclipse UserFriend
Mark,

Were you able to see or run the example I uploaded?
If it is in a jar file drop it under WEB-INF/lib not classes, although I
thought that would work as well. If that doesnt work unjar the whole thing
in the classes directory to get it working.
Jar should be fine.

Once I got it working, you can either War up everthing or use the standalone
Engine download, which contains a War file already. You can modify it and
reWar it.

Jason Weathersby
BIRT PMC


"Mark Lorenz" <mlorenz@nc.rr.com> wrote in message
news:9c45858cd58d8960b72d8ecb73d4233c$1@www.eclipse.org...
> Just for further info, here's the full error reported on Preview:
>
> There are errors on the report page: - There are error(s) in Grid:null
> Error0 : data.engine.JSScriptInvalid(1 time)detail: Invalid Javascript
> expression. Source: DataSet:LabCorp.fetch, line: 0,
> Expression:function_prefix_1130849946059();function
> function_prefix_1130849946059(){return false; //no rows, just
> attributes}Script engine error: missing } after function body- There are
> error(s) in Data:null Error0 : data.engine.JSScriptInvalid(1 time)detail:
> Invalid Javascript expression. Source: DataSet:LabCorp.fetch, line: 0,
> Expression:function_prefix_1130849946060();function
> function_prefix_1130849946060(){return false; //no rows, just
> attributes}Script engine error: missing } after function bodyError1 :
> Failed to evaluate labCorp.getName() + " Results Report"(1 time)detail:
> Failed to evaluate labCorp.getName() + " Results Report"TypeError: getName
> is not a function. (#1)
>
Re: Reporting POJO attributes [message #86151 is a reply to message #86077] Tue, 01 November 2005 10:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mlorenz.nc.rr.com

Jason - I moved the .jar file to the lib directory - same result.

BTW, I have not been able to use the appends from the other response (I
don't know how to convert to useful files), so I don't know if it works
for me or not.

Mark

P.S. Is the main() method supposed to do something specific or should I
invoke report from main()? Doesn't seem like this should be required, but
just wondered if there's something related to the .java design that could
cause problems. (This is all so frustrating ... I expect this is something
trivial that is keeping it all from working)
Re: Reporting POJO attributes [message #86166 is a reply to message #86077] Tue, 01 November 2005 10:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: m.n.com

I've had to restart Eclipse to get it to see anything new in WEB-INF/lib or
classes dir.


"Jason Weathersby" <jweathersby@actuate.com> wrote in message
news:dk7ug8$lgr$1@news.eclipse.org...
> Mark,
>
> Were you able to see or run the example I uploaded?
> If it is in a jar file drop it under WEB-INF/lib not classes, although I
> thought that would work as well. If that doesnt work unjar the whole
> thing in the classes directory to get it working.
> Jar should be fine.
>
> Once I got it working, you can either War up everthing or use the
> standalone Engine download, which contains a War file already. You can
> modify it and reWar it.
>
> Jason Weathersby
> BIRT PMC
>
>
> "Mark Lorenz" <mlorenz@nc.rr.com> wrote in message
> news:9c45858cd58d8960b72d8ecb73d4233c$1@www.eclipse.org...
>> Just for further info, here's the full error reported on Preview:
>>
>> There are errors on the report page: - There are error(s) in Grid:null
>> Error0 : data.engine.JSScriptInvalid(1 time)detail: Invalid Javascript
>> expression. Source: DataSet:LabCorp.fetch, line: 0,
>> Expression:function_prefix_1130849946059();function
>> function_prefix_1130849946059(){return false; //no rows, just
>> attributes}Script engine error: missing } after function body- There are
>> error(s) in Data:null Error0 : data.engine.JSScriptInvalid(1 time)detail:
>> Invalid Javascript expression. Source: DataSet:LabCorp.fetch, line: 0,
>> Expression:function_prefix_1130849946060();function
>> function_prefix_1130849946060(){return false; //no rows, just
>> attributes}Script engine error: missing } after function bodyError1 :
>> Failed to evaluate labCorp.getName() + " Results Report"(1 time)detail:
>> Failed to evaluate labCorp.getName() + " Results Report"TypeError:
>> getName is not a function. (#1)
>>
>
>
Re: Reporting POJO attributes [message #86211 is a reply to message #86151] Tue, 01 November 2005 10:57 Go to previous message
Eclipse UserFriend
Mark,

I am sorry you are having problems.
I am reattaching my example as a zip file.
Let me know if you get it.
I am also sending to your email.
I am not sure what you mean by the main() method.
If you mean in your class, definately not. The one you posted should work
fine.
What version of the BIRT are you using.

Jason Weathesby
BIRT PMC


"Mark Lorenz" <mlorenz@nc.rr.com> wrote in message
news:23632296e06348f0d29af72966d679ff$1@www.eclipse.org...
> Jason - I moved the .jar file to the lib directory - same result.
>
> BTW, I have not been able to use the appends from the other response (I
> don't know how to convert to useful files), so I don't know if it works
> for me or not.
>
> Mark
>
> P.S. Is the main() method supposed to do something specific or should I
> invoke report from main()? Doesn't seem like this should be required, but
> just wondered if there's something related to the .java design that could
> cause problems. (This is all so frustrating ... I expect this is something
> trivial that is keeping it all from working)
>


Previous Topic:Can I use BIRT to create a RTF report from a swing app.
Next Topic:Interdependant parameters
Goto Forum:
  


Current Time: Fri May 09 08:29:21 EDT 2025

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

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

Back to the top