<!-- source: docs/api/2_capi/globalgamestatistics/incrementglobalstats.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/globalgamestatistics/incrementglobalstats -->

# IncrementGlobalStats

Atomically increment (or decrement) global statistics. Global statistics are defined through the brainCloud portal.

StatisticsData like

`{ "stat1" : 10, "stat2" : -5.5 }`

would increment stat1 by 10 and decrement stat2 by 5.5. For the full statistics grammar see the [statistics grammar section](/api/appendix/statisticsgrammar).

There are many more complex operations supported such as

`{ "stat1" : "INC_TO_LIMIT#9#30" }`

which increments stat1 by 9 up to a limit of 30.

| Service | Operation |
| ------- | --------- |
| globalGameStatistics | UPDATE_INCREMENT |

## Method Parameters
Parameter | Description
--------- | -----------
statistics | A collection containing the statistics to increment

## Usage

**C#:**

```csharp
string statistics = "{\"PLAYER_COUNT\":1}";
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GlobalStatisticsService.IncrementGlobalStats(statistics, successCallback, failureCallback);
```

**C++:**

```cpp
const char *statistics = "{\"PLAYER_COUNT\":1}";

_bc->getGlobalStatisticsService()->incrementGlobalStats(statistics, this);
```

**Obj-C:**

```objectivec
NSString *statistics = @"{\"PLAYER_COUNT\":1}";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc globalStatisticsService] incrementGlobalStats:statistics
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String statistics = "{\"PLAYER_COUNT\":1}";
this; // implements IServerCallback

_bc.getGlobalStatisticsService().incrementGlobalStats(statistics, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var statistics = {
    "PLAYER_COUNT": 1
};

_bc.globalStatistics.incrementGlobalStats(statistics, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  statistics = {
    "PLAYER_COUNT": 1
};

ServerResponse result = await _bc.globalGameStatisticsService.incrementGlobalStats(statistics:statistics);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local statistics = {
    PLAYER_COUNT = 1
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.globalStatistics:incrementGlobalStats(statistics, callback)
```

**GDScript:**

```gdscript
var statistics = {
    "PLAYER_COUNT": 1
}

var result = await _bc.global_statistics_service.increment_global_stats(statistics)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local stats = { PLAYER_COUNT = 1 }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.globalStatistics:incrementGlobalStats(stats, callback)
```

**Cloud Code:**

```cfscript
var statistics = {
    "PLAYER_COUNT": 1
};
var globalStatisticsProxy = bridge.getGlobalStatisticsServiceProxy();

var postResult = globalStatisticsProxy.incrementGlobalStats(statistics);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
// N/A
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {
        "statistics": {
            "PLAYER_COUNT": 16
        }
    }
}
```
</details>


---

<!-- source: docs/api/2_capi/globalgamestatistics/index.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/globalgamestatistics -->

# Global Statistics

The Global Statistics service allows you to retrieve and update your app's predefined statistics defined on the
[Global Statistics](https://portal.braincloudservers.com/admin/dashboard#/development/stats-game) page of the brainCloud portal.

Global Statistics must be pre-defined from the [Statistics Rules - Global Statistics page](https://portal.braincloudservers.com/admin/dashboard#/development/stats-game)
of the brainCloud portal.  If instead you need to create them dynamically at runtime, you can enable the Generate App Statistic Rule Enabled setting on the
[Advanced Settings page](https://portal.braincloudservers.com/admin/dashboard#/development/core-settings-advanced-settings) of your app in the brainCloud portal.

Global (or App) Statistics are similar to User Stats, except that they are stored centrally across all of an app's users.

### API Summary

### Global Statistics

* [ReadAllGlobalStats](/api/capi/globalstatistics/readallglobalstats) - Returns all of the global statistics.
* [ReadGlobalStatsForCategory](/api/capi/globalstatistics/readglobalstatsforcategory) - Reads a subset of global statistics belonging to the specified category (all if omitted).
* [ReadGlobalStatsSubset](/api/capi/globalstatistics/readglobalstatssubset) - Reads a subset of global statistics as defined by the input JSON.
* [IncrementGlobalStats](/api/capi/globalstatistics/incrementglobalstats) - Atomically increment (or decrement) global statistics.
* [ProcessStatistics](/api/capi/globalstatistics/processstatistics) - Apply statistics grammar to a partial set of statistics.


---

<!-- source: docs/api/2_capi/globalgamestatistics/processstatistics.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/globalgamestatistics/processstatistics -->

# ProcessStatistics

Apply statistics grammar to a partial set of statistics. Global statistics are defined through the brainCloud portal.

The operations available are much richer than the standard *increment* operation available via `IncrementGlobalStats()`.

For example:
```
{
    "INNING": "INC#1",              // Increment by one
    "INNINGSREM": "DEC#1",          // Decrement by one
    "OUTS": "RESET",                // Reset to the defined initial value
    "POINTS": "INC_TO_LIMIT#5#30",  // Increment by 5, but to a max of 30
    "PLAYERS": "SET#8",             // Set to the specified value
    "HIGHESTHR": "MAX#3",           // Set to the specified value if larger
    "ESTIMATE": "MIN#5",            // Set to the specified value if smaller
    "GAME" : "5"                    // Missing stat grammar will treat the operation as an increment
}
```

The above example would:

* Increment `INNING` by `1`
* Decrement `INNINGSREM` by `1`
* Reset `OUTS` to its pre-defined initial value
* Increment `POINTS` by `5`, but to a maximum of `30`
* Set `PLAYERS` to `8`
* Set `HIGHESTHR` to `3`, or remain at current higher value
* Set `ESTIMATE` to `5`, or remain at current lower value
* Increment `GAME` by `5`

For the full statistics grammar see the [statistics grammar section](/api/appendix/statisticsgrammar).

| Service | Operation |
| ------- | --------- |
| globalGameStatistics | PROCESS_STATISTICS |

## Method Parameters
Parameter | Description
--------- | -----------
statistics | A collection containing the statistics to process

## Usage

**C#:**

```csharp
string statistics = "{\"INNING\":\"INC#1\",\"INNINGSREM\":\"DEC#1\",\"OUTS\":\"RESET\",\"POINTS\":\"INC_TO_LIMIT#5#30\",\"PLAYERS\":\"SET#8\",\"HIGHESTHR\":\"MAX#3\",\"ESTIMATE\":\"MIN#5\"}";
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GlobalGameStatisticsService.ProcessStatistics(statistics, successCallback, failureCallback);
```

**C++:**

```cpp
const char *statistics = "{\"INNING\":\"INC#1\",\"INNINGSREM\":\"DEC#1\",\"OUTS\":\"RESET\",\"POINTS\":\"INC_TO_LIMIT#5#30\",\"PLAYERS\":\"SET#8\",\"HIGHESTHR\":\"MAX#3\",\"ESTIMATE\":\"MIN#5\"}";
_bc->getGlobalGameStatisticsService()->processStatistics(statistics, this);
```

**Obj-C:**

```objectivec
NSString *statistics = @"{\"INNING\":\"INC#1\",\"INNINGSREM\":\"DEC#1\",\"OUTS\":\"RESET\",\"POINTS\":\"INC_TO_LIMIT#5#30\",\"PLAYERS\":\"SET#8\",\"HIGHESTHR\":\"MAX#3\",\"ESTIMATE\":\"MIN#5\"}";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc globalGameStatisticsService] processStatistics:statistics
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String statistics = "{\"INNING\":\"INC#1\",\"INNINGSREM\":\"DEC#1\",\"OUTS\":\"RESET\",\"POINTS\":\"INC_TO_LIMIT#5#30\",\"PLAYERS\":\"SET#8\",\"HIGHESTHR\":\"MAX#3\",\"ESTIMATE\":\"MIN#5\"}";
this; // implements IServerCallback

_bc.getGlobalGameStatisticsService().processStatistics(statistics, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var statistics = {
    "INNING": "INC#1",
    "INNINGSREM": "DEC#1",
    "OUTS": "RESET",
    "POINTS": "INC_TO_LIMIT#5#30",
    "PLAYERS": "SET#8",
    "HIGHESTHR": "MAX#3",
    "ESTIMATE": "MIN#5"
};

_bc.globalGameStatistics.processStatistics(statistics, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  statistics = {
    "INNING": "INC#1",
    "INNINGSREM": "DEC#1",
    "OUTS": "RESET",
    "POINTS": "INC_TO_LIMIT#5#30",
    "PLAYERS": "SET#8",
    "HIGHESTHR": "MAX#3",
    "ESTIMATE": "MIN#5"
};

ServerResponse result = await _bc.globalGameStatisticsService.processStatistics(statistics:statistics);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local statistics = {
    INNING = "INC#1",
    INNINGSREM = "DEC#1",
    OUTS = "RESET",
    POINTS = "INC_TO_LIMIT#5#30",
    PLAYERS = "SET#8",
    HIGHESTHR = "MAX#3",
    ESTIMATE = "MIN#5"
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.globalStatistics:processStatistics(statistics, callback)
```

**GDScript:**

```gdscript
var statistics = {
    "INNING": "INC#1",
    "INNINGSREM": "DEC#1",
    "OUTS": "RESET",
    "POINTS": "INC_TO_LIMIT#5#30",
    "PLAYERS": "SET#8",
    "HIGHESTHR": "MAX#3",
    "ESTIMATE": "MIN#5"
}

var result = await _bc.global_statistics_service.process_statistics(statistics)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local stats = {
    INNING = "INC#1",
    INNINGSREM = "DEC#1",
    OUTS = "RESET",
    POINTS = "INC_TO_LIMIT#5#30",
    PLAYERS = "SET#8",
    HIGHESTHR = "MAX#3",
    ESTIMATE = "MIN#5"
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.globalStatistics:processStatistics(stats, callback)
```

**Cloud Code:**

```cfscript
var statistics = {
    "INNING": "INC#1",
    "INNINGSREM": "DEC#1",
    "OUTS": "RESET",
    "POINTS": "INC_TO_LIMIT#5#30",
    "PLAYERS": "SET#8",
    "HIGHESTHR": "MAX#3",
    "ESTIMATE": "MIN#5"
};
var globalStatisticsProxy = bridge.getGlobalStatisticsServiceProxy();

var postResult = globalStatisticsProxy.processStatistics(statistics);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
// N/A
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "statisticsExceptions": {
            "INNINGSREM": "minApplied"
        },
        "statistics": {
            "OUTS": 0,
            "HIGHESTHR": 4,
            "PLAYERS": 8,
            "INNINGSREM": 0,
            "INNING": 2,
            "POINTS": 11,
            "ESTIMATE": 5
        }
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/globalgamestatistics/readallglobalstats.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/globalgamestatistics/readallglobalstats -->

# ReadAllGlobalStats

Method returns all of the global statistics.

| Service | Operation |
| ------- | --------- |
| globalGameStatistics | READ |

## Usage

**C#:**

```csharp
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GlobalStatisticsService.ReadAllGlobalStats(successCallback, failureCallback);
```

**C++:**

```cpp

_bc->getGlobalStatisticsService()->readAllGlobalStats(this);
```

**Obj-C:**

```objectivec
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc globalStatisticsService] readAllGlobalStats:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
this; // implements IServerCallback

_bc.getGlobalStatisticsService().readAllGlobalStats(this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript

_bc.globalStatistics.readAllGlobalStats(result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart

ServerResponse result = await _bc.globalGameStatisticsService.readAllGlobalStats();

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.globalStatistics:readAllGlobalStats(callback)
```

**GDScript:**

```gdscript
var result = await _bc.global_statistics_service.read_all_global_stats()

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.globalStatistics:readAllGlobalStats(callback)
```

**Cloud Code:**

```cfscript
var globalStatisticsProxy = bridge.getGlobalStatisticsServiceProxy();

var postResult = globalStatisticsProxy.readAllGlobalStats();
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
// N/A
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": {
        "statistics": {
            "TotalXpEarned": 0,
            "_GAME_LOGINS": 805
        }
    }
}
```
</details>


---

<!-- source: docs/api/2_capi/globalgamestatistics/readglobalstatsforcategory.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/globalgamestatistics/readglobalstatsforcategory -->

# ReadGlobalStatsForCategory

Method retrieves the global statistics for the given category.

| Service | Operation |
| ------- | --------- |
| globalGameStatistics | READ_FOR_CATEGORY |

## Method Parameters
Parameter | Description
--------- | -----------
category | The global statistics category

## Usage

**C#:**

```csharp
string category = "generated";
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GlobalStatisticsService.ReadGlobalStatsForCategory(category, successCallback, failureCallback);
```

**C++:**

```cpp
const char *category = "generated";

_bc->getGlobalStatisticsService()->readGlobalStatsForCategory(category, this);
```

**Obj-C:**

```objectivec
NSString *category = @"generated";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc globalStatisticsService] readGlobalStatsForCategory:category
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String category = "generated";
this; // implements IServerCallback

_bc.getGlobalStatisticsService().readGlobalStatsForCategory(category, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var category = "generated";

_bc.globalStatistics.readGlobalStatsForCategory(category, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  category = "generated";

ServerResponse result = await _bc.globalGameStatisticsService.readGlobalStatsForCategory(category:category);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local category = "generated"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.globalStatistics:readGlobalStatsForCategory(category, callback)
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
local category = "generated"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.globalStatistics:readGlobalStatsForCategory(category, callback)
```

**Cloud Code:**

```cfscript
var category = "generated";
var globalStatisticsProxy = bridge.getGlobalStatisticsServiceProxy();

var postResult = globalStatisticsProxy.readGlobalStatsForCategory(category);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
// N/A
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "statistics": {
            "ESTIMATE": 5,
            "HIGHESTHR": 4,
            "INNING": 2,
            "INNINGSREM": 0,
            "INNINGnew": 1,
            "OUTS": 0,
            "PLAYERS": 8,
            "PLAYER_COUNT": 4,
            "PLAYER_COUNTa": 1,
            "POINT": 1,
            "POINTS": 11,
            "otherstat": 0
        }
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/2_capi/globalgamestatistics/readglobalstatssubset.md -->
<!-- url: https://docs-internal.braincloudservers.com/api/capi/globalgamestatistics/readglobalstatssubset -->

# ReadGlobalStatsSubset

Reads a subset of global statistics.

| Service | Operation |
| ------- | --------- |
| globalGameStatistics | READ_SUBSET |

## Method Parameters
Parameter | Description
--------- | -----------
statistics | A collection containing the statistics to read

## Usage

**C#:**

```csharp
string[] statistics = { "ESTIMATE", "POINTS" };
SuccessCallback successCallback = (response, cbObject) =>
{
    Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
    Debug.Log(string.Format("Failed | {0}  {1}  {2}", status, code, error));
};

_bc.GlobalStatisticsService.ReadGlobalStatsSubset(statistics, successCallback, failureCallback);
```

**C++:**

```cpp
std::vector<std::string> statistics;
statistics.push_back("ESTIMATE", "POINTS");

_bc->getGlobalStatisticsService()->readGlobalStatsSubset(statistics, this);
```

**Obj-C:**

```objectivec
NSArray *statistics = @[ @"ESTIMATE", @"POINTS" ];
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc globalStatisticsService] readGlobalStatsSubset:statistics
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String[] statistics = { "ESTIMATE", "POINTS" };
this; // implements IServerCallback

_bc.getGlobalStatisticsService().readGlobalStatsSubset(statistics, this);

public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
    System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
    System.out.print(String.format("Failed | %d %d %s", statusCode,  reasonCode, jsonError.toString()));
}
```

**JavaScript:**

```javascript
var statistics = [ "ESTIMATE", "POINTS" ];

_bc.globalStatistics.readGlobalStatsSubset(statistics, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  statistics = [ "ESTIMATE", "POINTS" ];

ServerResponse result = await _bc.globalGameStatisticsService.readGlobalStatsSubset(statistics:statistics);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local statistics = { "ESTIMATE", "POINTS" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.globalStatistics:readGlobalStatsSubset(statistics, callback)
```

**GDScript:**

```gdscript
var statistics = [ "ESTIMATE", "POINTS" ]

var result = await _bc.global_statistics_service.read_global_stats_subset(statistics)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local stats = { "ESTIMATE", "POINTS" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.globalStatistics:readGlobalStatsSubset(stats, callback)
```

**Cloud Code:**

```cfscript
var statistics = [ "ESTIMATE", "POINTS" ];
var globalStatisticsProxy = bridge.getGlobalStatisticsServiceProxy();

var postResult = globalStatisticsProxy.readGlobalStatsSubset(statistics);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
// N/A
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "statistics": {
            "POINTS": 11,
            "ESTIMATE": 5
        }
    },
    "status": 200
}
```
</details>
