Mixujusij
Mixujusij

Reputation: 3

JasperReports. How to count records in time interval and display it in chart

I have a table for storing event information. When event is launched it creates new record in table. Each record contains timestamp value that represents time when event was launched.

For example:

Table EVENT_DATA
integer ID
varchar NAME
timestamp STARTIME
etc...

What I need to do is to calculate amount of events in each hour of a day and display them in a chart. Is it possible to achieve this only by means of iReport or JapsersoftStudio?

Upvotes: 0

Views: 694

Answers (1)

drewich
drewich

Reputation: 148

Yes, you just need to work the query which will return your data.

I haven't tested it but it should be something like this:

SELECT EXTRACT(HOUR FROM startime), count(id)
FROM EVENT_DATA
WHERE startime BETWEEN :a AND :b
GROUP BY EXTRACT(HOUR FROM startime)

Of course the query depends on your database.

Upvotes: 1

Related Questions