DataPairs help

S

sconeek

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
 
R

Rhino

sconeek said:
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
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
 
S

sconeek

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top