Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

DataPairs help

Thread view: 
sconeek - 16 Nov 2005 02:03 GMT
Hi all,
am working on a java based web app. it connects to jasper to generate
reports. now i am generating a report which containts various
datapoints. however if the datapoint is zero, it doesnt show up in my
graph. any ideas to how i can work that out. a little bit of my code is
at the bottom.

LinkedList dataPairs = new LinkedList();
while (rs.next()) {
DataPair dataPair = new DataPair(rs.getString(code),
rs.getString(description));
dataPairs.add(dataPair);
}
return dataPairs;

all help/suggestions appreciated.
cheers
Rhino - 16 Nov 2005 05:08 GMT
> Hi all,
> am working on a java based web app. it connects to jasper to generate
[quoted text clipped - 13 lines]
> all help/suggestions appreciated.
> cheers

Have you tried executing your code in the debugger of a good IDE? That's how
I find problems in my servlets. I use Eclipse but there are other good IDEs
as well; I've heard good things about Net Beans for example, although I've
never used it.

That would help you figure out if your LinkedList is empty or not; if it is
empty, you could figure out why.

The while(rs.next()) in your code fragment strongly suggests that you are
looping through an SQL result set and using values obtained from that result
set to populate your DataPair object. Are you aware that if the result set
is empty, the while() loop will not execute even once. That could explain
why your DataPair object is empty - if it is - and could also explain why
your graph doesn't display any points. I would suggest looking at your SQL
to see if it might possibly have a mistake in it or be pointing at an empty
table instead of the one that has the expected data.

Rhino
sconeek - 16 Nov 2005 22:22 GMT
yeah thanks. i think you are right, i should look in my SQL code rather
than the java code, as the java code is doing whatever is passed from
SQL, so if 0 data points are not passed at all it will not show up.
will get back on this shortly. cheers


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.