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:
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 VALUE from DAY a2 where'MORNING' and         
   (select VALUE from DAY a2 where'NOON' and
   (select VALUE from DAY a2 where'EVENING' and
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/ user can change log level from INFO to DEBUG, to see information from the pool when a connection is created/used:, CONNECTION_FILE

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.

Tuesday, May 19, 2015

NextReports: Analysis versus Table Widgets

Even if a table widget inside a dashboard seems to be similar to an analysis table, there are many differences between them.

"Analysis" is a special object with following major differences than a widget table:
  • Analysis shows raw data (no patterns are used) and that makes the possibility to easily have sortable columns
  • Analysis can have a list of sortable columns (sort by column1, then column 2, ….)
  • Analysis persists sortable columns
  • Analysis has a lot of other features  like selection, grouping, filtering, pagination, freeze.
  • Analysis uses local data brought here by an ETL process
"Table Widget" has the following characteristics :
  • Table Widget has behind a report with a layout
  • Table widget may contain formatted data (if patterns are used like for dates, numbers,..)
  • The report behind a table widget may contain different type of values on same column (because report's layout can have more than one detail band). 
  • Table Widget may have a style (foreground and background colors)
From version 8.1 of NextReports Server :
  • Table widgets will have a header with sorting columns. 
  • Sorting is added only to those table widgets that contain only one detail band (the actual database columns). On all others table widgets sorting has no sense.
  • Sorting on table widgets is not persisted, so if you will leave dashboard and return or if you do a refresh the sorting will disappear. But if you sort, you are able (before refresh) to Save to Excel with the used sorting.