ARGetEntryStatistics


Important

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.

Description

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.

Privileges

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).

Synopsis

#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

control

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.

schema

The name of the form to compute entry statistics.

qualifier

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 if a field does not exist.

Specify NULL or assign an operation value of 0 (AR_COND_OP_NONE) to match all form entries.

target

The arithmetic operation that defines the statistics to compute. The statistics 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 if a field does not exist.

You can specify AR_STAT_OP_COUNT for the statistic parameter, and assign a tag value of 0 to omit this parameter.

statistic

A value that indicates the statistic type.

groupByList

A list of zero or more fields to group the results. 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

results

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 statistics 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

status

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.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*