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.
Parent Topic:Server API reference
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: - true: Return only indicators that display on the Analytics Hub. - all: Return all indicators. 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. - true returns display values for all of the fields. - false returns actual values from the database. - all returns both actual and display values. 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: - true: Hide additional information provided for reference fields. - false: Do not hide additional information provided for reference fields. Default: false |
| favorites | Boolean | Flag that indicates whether to return only indicators that are favorites of the querying user.Valid values: - true: Return only indicators that are favorites of the querying user. - false: Return all indicators. 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 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: - true: Return all available aggregates for an indicator when no aggregate has been applied. - false: Return no aggregates. Default: false |
| include\_available\_breakdowns | Boolean | Flag that indicates whether to return all available breakdowns for an indicator.Valid values: - true: Return all available breakdowns for an indicator. - false: Return no breakdowns. 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 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: - true: Return the realtime\_enabled element. - false: Do not return the realtime\_enabled element. 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: - true: Return the target\_color\_scheme element. - false: Do not return the target\_color\_scheme element. 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: - true: Return the trendline\_scores element. - false: Do not return the trendline\_scores element . 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: - bullet - change - changeperc - date - default - direction - duedate - frequency - gap - gapperc - group - indicator\_group - name - order - target - trend - value Default: value |
| sortdir | String | Sort direction.Valid values: - asc: Denotes ascending - des: Denotes descending 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: - true: Only return results for indicators that have a target set. - false: Return results for all applicable indicators. 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). Note: 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. |