Пример скриптового запроса
import org.pentaho.reporting.engine.classic.core.util.TypedTableModel;
import java.sql.*;
 
String userName = "root";
String password = "root";
String url = "jdbc:mysql://localhost/airs";
Class.forName ("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection(url, userName, password);
Statement s = conn.createStatement();
Object tableName = dataRow.get("history_level");
if (tableName == null)
    tableName = "h1";
Object signalType = dataRow.get("signal_type");
Object equipmentGroup = dataRow.get("equipment_group");
 
String query = "SELECT DISTINCT tstamp, concat(substr(tstamp,7,2),'.',substr(tstamp,5,2),'.',substr(tstamp,1,4),' ',substr(tstamp,9,2)," +
"':',substr(tstamp,11,2)) AS tstamp_normal FROM " +
tableName + " WHERE type = '" + signalType + "' AND a_stat = " + equipmentGroup;
s.executeQuery(query);
ResultSet rs = s.getResultSet();
 
String[] columnNames = new String[2];
columnNames[0] = "tstamp";
columnNames[1] = "tstamp_normal";
Class[] columnTypes = new Class[2];
columnTypes[0] = String.class;
columnTypes[1] = String.class;
 
TypedTableModel model = new TypedTableModel(columnNames, columnTypes);
 
while (rs.next())
{
      model.addRow(new Object[]{rs.getString("tstamp"),rs.getString("tstamp_normal")});
}
rs.close();
s.close();
return model;