Reporting Configuration
This page provides information for creating a configuration file for use during report generation. This configuration file is a payload JSON file that can contain various report settings.
The following code sample shows the available objects that you can include within such a file. The rest of this page provides details about each of these objects and their properties. All objects are optional.
{
"format": "csv",
"dateTimeSettings": {
"dateFormat": "DB_date_format",
"timeFormat": "h:mm tt",
"dateTimeFormat": "yyyy-MM-dd H:mm:ss"
},
"filters": [
{
"name": "Application",
"value": "myApp"
},
{
"name": "Folder",
"value": "myFolder"
}
]
}
Report Format
You can specify the report format in the configuration file instead of specifying it in the API command for report generation.
You can set the format to one of the following values:
-
csv (default)
-
pdf
-
excel (.xslx file)
"format": "pdf"
Date and Time Formats
The dateTimeSettings object enables you to set the format of dates and times in reports, overriding the default formats inherited from your browser.
The following table describes the dateTimeSettings object properties.
Property |
Description |
---|---|
dateFormat |
Format of dates in the report. Valid values:
|
timeFormat |
Format of times in the report. Valid values:
|
dateTimeFormat |
Format of timestamps that include both the date and the time. Valid values:
|
For example:
"dateTimeSettings": {
"dateFormat": "DB_date_format",
"timeFormat": "h:mm tt",
"dateTimeFormat": "yyyy-MM-dd H:mm:ss"
}
Filter Values
The filters object enables you to set new values for filters that were defined in the report in Control-M Reports, overriding the original filter values in the report definitions.
For each filter value that you want to override, you include a pair of name and value properties. For example:
"filters": [
{
"name": "Application",
"value": "myApp"
},
{
"name": "Folder",
"value": "myFolder"
}
]
Note the following additional guidelines:
-
To simplify the process, you can generate a list of all filters defined in the report (in JSON format) and use that list as the starting point for an edited list (with different filter values). You can then submit your edited list using the API command for generating a report. To obtain the list of filters, you have the following options:
-
Use the reporting reportFilters::get API command.
-
Export a JSON file from the Control-M Reports GUI, as described in Exporting filter definitions.
-
-
Ensure that any filter that you want to override has a unique name in the report (that is, in Control-M Reports, the value in the left-hand-side field is used in only one filter in the report definitions).
If you want to dynamically populate the filter values (for example, based on a job variable), you can schedule a command-type or script-type job to run together with the reporting command, as in the following example:
echo '{"filters": [
{"name":"Alert ID","value":"%%AlertID"}
]}' > filter.json | ctm reporting report::get Alerts_1 csv -f filter.json
In this example, the first command creates the filter.json file, to be used by the reporting command as the configuration file, and the second command runs the reporting command.
The Alert ID is the filter whose value you want to override and %%AlertID is the predefined job variable.