Thursday, July 14, 2016

"Error:null" when clicking the "Read Fields" button in the Query Editor

Sometimes the "Error:null" error  appears after clicking the "Read Fields" button in the Query Editor or after autorefresh. One of the causes for this can be usage of literal parameters like $P!{param} in the query which the editor cannot calculate at the time. Just delete the parameter temporarily and restore it after "read fields" completes.

How to detect if Jasper Reports output was generated by a scheduled run

Sometimes it is necessary to have some conditional logic in case a report is being run by a scheduler. In this case it is possible to use _ScheduledTime parameter from the built-in REPORT_PARAMETERS_MAP map.

Example expression:

$P{REPORT_PARAMETERS_MAP}.get("_ScheduledTime") == null ? "Normal" : "Scheduled"