Report Examples
This topic provides some sample Report Definitions and report formatting examples.
Reporting on Processes in an Error State
To create a report on processes in an error state:
- Navigate to Definitions > Reports.
- Click
.
- On the Report Definition tab, enter
AllErrorJobs
in the Name field, then do one of the following things:- In the SQL Query field, enter
select * from Job where Job.Status = 'E'
. - From the Query Filter dropdown list, choose theWith Status "Error" query filter with an Object Definition of Job.
- In the SQL Query field, enter
- On the Columns tab, uncheck Display for any columns you want to hide.
- To sort the columns by the process ID in ascending order, click the Sorting tab, choose Job.jobId from the Report Column dropdown list, and check Ascending.
- Click the Report Preview tab to see a preview of the report in HTML format.
- Choose Save & Close.
To generate the report and view its output:
- Navigate to Definitions > Reports and choose Submit from the AllErrorJobs Report Definition's context menu.
- Set OutputFormat to HTMLText.
- Click the Control tab and choose a Queue.
- Click Submit.
- Right-click the AllErrorJobs Report Definition and choose Monitor Related Processes.
- Click AllErrorJobs in the Related Processes tab.
- In the Detail View, click report.html to view the report.
Creating a Report Definition in RedwoodScript
To create a Report Definition in RedwoodScript, use code like the following.
import com.redwood.scheduler.api.model.report.Reporter;
import com.redwood.scheduler.api.model.report.ReportDestination;
{
String query = "select Job.JobId,Job.Description from Job where Job.JobId <= 244";
Reporter reporter = jcsSession.createReporter(jcsOut);
ReportDestination destination = reporter.getCSVReportDestination();
jcsSession.executeQuery(query, null, destination);
}
Report Formatting Examples
Assume you are creating a Report Definition that lists completed processes.
If you want to format the RunTime
column in the report to use the format 0:00:00:000, you can add a row for Job.RunTime
in the Columns tab and enter the REL expression=Time.formatDurationEx(Job.RunTime, '|||||#|:#|:#|:#')
in the Value field. When you preview the report, you should see that a process that ran for 6000 milliseconds displays a value of 0:00:06:000
.
If you would also like to have a column containing the remote run time in minutes and seconds (for example, 5min 48sec
), add a column and calculate the value by subtracting RemoteRunStart
from RemoteRunEnd
, as follows.
=Time.formatDurationEx(Job.RemoteRunEnd - Job.RemoteRunStart, '||||||#min| #sec|')
If you would like to format a date as yyyy.MM.dd hh:mm:ss
, you could use a REL expression like the following.
=Time.format(Job.RunEnd, 'yyyy.MM.dd hh:mm:ss')