Tuesday, July 14, 2015

NextReports: Grid Style for Charts

NextReports charts can have a grid shown for x, y values. Till version 8.2, this grid can only be a full-line of a specific color. From version 8.2 this grid can also have style like line, dashed line or dotted line. This style is specified for both X and Y grid lines:


By default, simple line style is used:


The other two styles are dashed line:


and dotted line:


This feature is available on all modern browsers and it is supported from Firefox 27+, IE 11+.

Monday, June 22, 2015

Adjust your SQL queries to see data series

Many users have data in a specific table format with a 'type' column and want to show inside a chart series for every value of 'type'.

Lets take a simple example of a DAY table (where NAME column is our 'type') :
NAME               VALUE               CREATION_DATE
----------------------------------------------------------------- 
MORNING            90                  2015-06-12
NOON               210                 2015-06-12
EVENING            60                  2015-06-12
MORNING            85                  2015-06-13
NOON               240                 2015-06-13
EVENING            50                  2015-06-13
MORNING            92                  2015-06-14
NOON               235                 2015-06-14
EVENING            55                  2015-06-14

We want to show DATE on x axis and series for MORNING, NOON, EVENING on y axis. To make this happen NextReports must obtain a query result like:
CREATION_DATE     MORNING_V    NOON_V   EVENING_V
-------------------------------------------------------------------------------------------------
2015-06-12        90           210      60 
2015-06-13        85           240      50   
2015-06-14        92           235      55 

Then it is very easy to add DATE on x axis and MORNING_V, NOON_V, EVENING_V on y axis as column series.

This transformation can be easily obtained using sub-queries. For example, on our table we will use following sql:
SELECT DISTINCT
   a1.CREATIONDATE,
   (select VALUE from DAY a2 where a2.name='MORNING' and         
              a2.CREATIONDATE=a1.CREATIONDATE) as MORNING_V,
   (select VALUE from DAY a2 where a2.name='NOON' and
              a2.CREATIONDATE=a1.CREATIONDATE) as NOON_V,
   (select VALUE from DAY a2 where a2.name='EVENING' and
              a2.CREATIONDATE=a1.CREATIONDATE) as EVENING_V
FROM
DAY a1

Thursday, June 04, 2015

NextReports Server: JNDI Data Source

Starting with version 8.1, NextReports Server (war) can use JNDI protocol to connect to such data sources defined inside some web server.

A new type (JNDI) was added and users will just need to specify the JNDI name:




Tuesday, May 26, 2015

NextReports: Batch Mode

From version 8.1 users can run/schedule a report in batch mode. What does this mean?
If a report has a single-selection parameter with a source and if this parameter is selected as a "batch parameter" then running it in batch mode will generate a report for every value of that batch parameter.

To make this right there are two conditions that must be met:
  1. Batch parameter must not be set as dynamic
  2. All chained parameters that are children of batch parameter must be set as dynamic.
These two conditions are also written inside batch definition panel and are automatically set on save if user does not do it.

As an example, we use a report that shows the Timesheet for an employee on all projects he is assigned to. There are two parameters : Employee and Work code (work, meeting, administration, travel) so we can see the Timesheet for that employee for a specific list of work codes.


Here we see that the parameter we want to use in batch (Employee) is not set as dynamic, but the other parameter (Code) which is a child of Employee parameter is set as dynamic.

Batch Mode is practically a new step in run/schedule wizard process:


"Employee" parameter was set as a batch parameter. This simple selection means the report will be generated for all "Employee" values.

Second field, called Batch Data Query, is a simple sql select that gives an email address for every Employee. First column in query must be the same as that used in source for Employee parameter, which is defined as:

select distinct employeeid, firstname || ' ' || name as fullName from employee

Second column in query is the email column.

Batch Data Query is needed only if we need to send every generated report to it's actual employee.

Mail Destination Step in this case is allowed to not define a To property, because it is dynamically set at run time:


But we can also select a To property if we also want to send all generated reports to a static email address. In mail step, we can see that besides existing template values until version 8.1 (like ${date}, ${time}, ${name}) we can use parameter values as $P{Employee} or $P{Code}. This allows to have a mail message customized for every employee.

Thursday, May 21, 2015

NextReports Server: Connection Logging

Starting from NextReports 8.1 connection creation is written to log for debug purposes. By default all connections are written to connections.log found inside <server_install_folder>/logs folder. Default log level type is INFO

Inside <server_install_folder>/webapps/nextreports-server/WEB-INF/classes/log4j.properties user can change log level from INFO to DEBUG, to see information from the pool when a connection is created/used:

log4j.logger.ro.nextreports.server.util.ConnectionUtil=INFO, CONNECTION_FILE
log4j.additivity.ro.nextreports.server.util.ConnectionUtil=false

Users will be able to see on DEBUG level how many connections are in pool (min and max values), how many connection are active, idle or busy.

In case you experience some connections problems (like timeouts) and you are sure your database is up and running, you should put this log's level on DEBUG and start accumulating data to reproduce the problem again.