This documentation supports the 9.1 version of Remedy Action Request System.

To view the latest version, select the version from the Product version menu.



You can continue to use C APIs to customize your application, but C APIs are not enhanced to support new capabilities provided by Java APIs and REST APIs.


Computes the indicated statistic for the form entries that match the conditions specified by the qualifier parameter and returns the values sorted in ascending order by the groupByList.


The system returns information based on the access privileges of the user that you specify for the control parameter. All statistics, therefore, are limited to entries the user can access (users must have permission for the entryId field to access and retrieve entries).


#include "ar.h"
#include "arerrno.h"
#include "arextern.h"
#include "arstruct.h"

int ARGetEntryStatistics(
   ARControlStruct *control,
   ARNameType schema,
   ARQualifierStruct *qualifier,
   ARFieldValueOrArithStruct *target,
   unsigned int statistic,
   ARInternalIdList *groupByList,
   ARStatisticsResultList *results,
   ARStatusList *status)

Input arguments


The control record for the operation. It contains information about the user requesting the operation, where that operation is to be performed, and which session is used to perform it. The user and server fields are required.


The name of the form to compute entry statistics for.


A query that determines the set of entries to use. The qualification can include one or more fields and any combination of conditional, relational, and arithmetic (numeric data types only) operations. The system generates an error if the user does not have read permission for a field or a field does not exist. Specify NULL or assign an operation value of 0 (AR_COND_OP_NONE) to match all form entries.


The arithmetic operation that defines the statistic to compute. The statistic can include one or more fields and any combination of arithmetic operations. The system generates an error if the user does not have read permission for a field or a field does not exist. If you specify AR_STAT_OP_COUNT for the statistic parameter, assign a tag value of 0 to omit this parameter.


A value that indicates the statistic type.


The total number of matching entries (AR_STAT_OP_COUNT).


The sum of values for each group (AR_STAT_OP_SUM).


The average value for each group (AR_STAT_OP_AVERAGE).


The minimum value for each group (AR_STAT_OP_MINIMUM).


The maximum value for each group (AR_STAT_OP_MAXIMUM).



A list of zero or more fields to group the results by. The system computes a result for each group of entries having the same value in the specified field. Specifying more than one field creates groups within groups, each of which returns a separate statistic. Specify NULL for this parameter (or zero fields) to compute a single result for all matching entries.

Return values


A list of zero or more results sorted in ascending order. If you specify one or more fields for the groupByList parameter, each item in the list represents a group. Each result structure contains the field values that define the group and the statistic for that group.

For example, if the query was to find a count of bugs grouped by submitter and then by status, the results would return data sorted by submitter and then sorted by status, as in the following list:

Abe Low 1
Abe Medium 3
Dani Low 11
Dani Medium 10
Dani High 5
Sarah Low 8
Sarah High 2


A list of zero or more notes, warnings, or errors generated from a call to this function. For a description of all possible values, see Error checking.

See also

ARCreateEntry, ARDeleteEntry, ARGetEntry, ARGetListEntry, ARLoadARQualifierStruct, ARMergeEntry, ARSetEntry. See FreeAR for: FreeARFieldValueOrArithStruct, FreeARInternalIdList, FreeARQualifierStruct, FreeARStatisticsResultList, FreeARStatusList.

Was this page helpful? Yes No Submitting... Thank you