PAScorecard - Scoped
The PAScorecard API enables you to fetch data about indicators and their associated records, such as breakdowns.
This API requires the Performance Analytics (com.snc.pa.analytics_center) application and runs in the SNC namespace.
PAScorecard - addParam(String parameter, String value)
Adds a query parameter to filter the returned scores.
Call this method multiple times on the same PAScorecard object to pass multiple parameters, such as the indicator sys_id and a breakdown sys_id. After specifying all parameters, call query() to run the query.
If you query a PAScorecard object with no parameters, the API returns a list of all indicators that are displayed on the Analytics Hub, with their scores.
| Name | Type | Description |
|---|---|---|
| breakdown | String | Sys_id of a breakdown to return chart information organized as defined by the breakdown. For example, the sys_id of a priority breakdown to return separate task chart information for each priority value, such as the number of open incidents / Priority / 2 - High. |
| breakdown_relation | String | Specify the sys_id of a breakdown relation to break down the returned data using that relation. You can view available breakdown relations by setting the include_available_breakdowns parameter to true. |
| contains | String | Comma-separated list of names or descriptions to return results only from indicators with a matching value. All the comma-separated list items must match, or no results are returned: The list follows AND logic, not OR logic. |
| display | String | Flag that indicates the type of indicators to return. Valid values:
Default: true |
| display_value | String | Data retrieval operation for reference and choice fields. Based on this value, the display value and/or the actual value in the database are retrieved.
Default: false |
| elements_filter | String | Specify the sys_id of an elements filter to apply that filter to the returned data. Data type: String |
| exclude_reference_link | Boolean | Flag that indicates whether to hide additional information provided for reference fields, such as the URI to the reference resource. Valid values:
Default: false |
| favorites | Boolean | Flag that indicates whether to return only indicators that are favorites of the querying user. Valid values:
Default: false |
| from | String | Earliest date to return scores from. Only scores from this date or later are returned.
This parameter requires that include_scores is set to true. Format: ISO-8601 standard |
| include_available_aggregates | String | Flag that indicates whether to return all available aggregates for an indicator when no aggregate has been applied. Valid values:
Default: false |
| include_available_breakdowns | Boolean | Flag that indicates whether to return all available breakdowns for an indicator. Valid values:
Default: false |
| include_forecast_scores | Boolean | Flag that indicates whether to return the forecast_scores element that contains an array of date-value pairs that define the forecast data for the
Analytics Hub
.
This parameter requires that include_scores is set to true. Valid values:
Default: false |
| include_realtime | Boolean | Flag that indicates whether to return the realtime_enabled element which indicates if real-time scores are enabled for the indicator, and the realtime_value element which contains
the real-time score value. This parameter is not supported for formula indicators. Valid values:
Default: false |
| include_scores | Boolean | Flag that indicates whether to return indicator scores for the entire time range selected on the
Analytics Hub
. If a value is not specified, this parameter defaults to false and returns only the most recent score value. To constrain the date range of the scores that are returned, combine this parameter with from and to. Valid values:
Default: false |
| include_target_color_scheme | Boolean | Flag that indicates whether to return the target_color_scheme element that contains the minimum and maximum values, and the color of each section of the target color scheme for
the
Analytics Hub
. Valid values:
Default: false |
| include_trendline_scores | String | Flag that indicates whether to return the trendline_scores element that contains an array of date-value pairs that define the
Analytics Hub
trendline. This parameter requires that include_scores is set to true. |
| key | Boolean | Flag that indicates whether to return results only for key indicators. Valid values:
Default: false |
| limit | Number | Maximum number of scores to return. |
| page | String | Specify the page number. For example, when querying 20 indicators in the Analytics Hub with the default per_page value (10), specify a page value of 2 to retrieve the Analytics Hub for 11-20. |
| per_page | Number | Maximum number of indicators each query can return on a page. Default: 10 Maximum: 100 |
| sortby | String | Value to use when sorting results. Valid values:
Default: value |
| sortdir | String | Sort direction. Valid values:
Default: Descending |
| step | Number | Numeric value to skip scores, based on the indicator frequency. For example, specify a value of 3 to return only scores from every third day for a daily indicator, or from every third week for a weekly indicator. |
| tags | String | Enter an indicator group sys_id to return the indicators in that group. Do not use uuid with this parameter. |
| target | Boolean | Flag that indicates whether to return results only for indicators that have a target set on the
Analytics Hub
. Valid values:
Default: false |
| to | String | Latest date from which to return scores. Only scores from this date or earlier are returned. This parameter requires that include_scores is set to true. |
| uuid | String | Enter a colon-separated list of sys_id values to specify which indicators, breakdowns, aggregates, and domains to query. The parameter follows this format: <indicator_sys_id>:<breakdown_sys_id>:<elements_filter_sys_id or element_sys_ids>:<lvl-2 breakdown_sys_id>:<lvl-2 elements_filter_sys_id or element_sys_ids>:<aggregate_sys_id>;<domain_sys_id> The parameter must begin with the sys_id of an indicator record. Optionally, you can append the sys_id values of a breakdown and breakdown element to group the response based on the breakdown, and the sys_id of an aggregate to apply that aggregate. You can use a breakdown with an aggregate, or use only one. For information about obtaining the sys_id values of records, see Unique record identifier (sys_id). Remarque : If an indicator is configured to use a Default time series, all Analytics Hub values for that indicator use that time series aggregation. |
| Type | Description |
|---|---|
| None |
In this example, the uuid parameter specifies the Number of open incidents indicator, and the breakdown parameter specifies the Priority breakdown. Both parameters have the sys_id of the respective records as their values. The query() function returns the results as an object.
var sc = new SNC.PAScorecard(); //in a scoped app, do not use the SNC namespace
sc.addParam('uuid', 'fb007202d7130100b96d45a3ce6103b4'); // Number of open incidents
sc.addParam('breakdown', '0df47e02d7130100b96d45a3ce610399'); // by Priority
var result = sc.query(); // Query results, which are returned as an object
for (var i = 0; i < result.length; i++)
gs.info(result[i].name + ': ' + result[i].value + ' ' + result[i].unit.display_value);
PAScorecard - query()
Perform a query based on the specified parameters and return the results as an object.
Before calling this method, configure parameters for the PAScorecard object by calling addParam(String parameter, String value).
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Object | The PAScorecard object. |
PAScorecard - result()
Get the last query result as an object.
This method does not perform a query. To perform a query before returning the result, use query().
This function cannot run in a scope other than global.
| Name | Type | Description |
|---|---|---|
| None |
| Type | Description |
|---|---|
| Object | The results from the last query, returned as a JS object. |