If your church is loving, living, and leading from Christ-centered community, then this very question has crossed your mind at some point, if not at the forefront of your mind in this current season of ministry.
Today’s tutorial sheds light and somewhat answers the posed question.
I say somewhat because the Church Community Builder (CCB) API service, individual_groups, returns a list of all groups a specified individual is associated with.
Specifying an individual is not a required parameter. In fact, there are no required parameters (see CCB Documentation), yet the following parameters are optional:
When an individual is not specified, then the groups for ALL individuals in the CCB system will be returned. Note that you could meet or exceed the daily CCB API Call Limit.
This presents a problem in truly answering the question. We often want to know the number adults in a group and not children.
For instance, a life, small, or community group could have 23 persons consisting of 15 adults and 8 children.
Answering the posed question, I would want to know specifically how many groups, rather the average, adults belong too.
The challenge with CCB’s API individuals_group service is that it returns ALL individuals when an individual is not specified.
And because we know this fact, this means children are included when this CCB API service is instantiated.
I won’t have time share how to integrate and retrieve the age of individuals in today’s tutorial. This information is quite easy to achieve using CCB’s API individual_profile_from_id service.
As a quick overview, the code below allows you to compute the average number of groups per individual as well as display the exact number of groups for each person within the CCB system in its entirety.
Remember, CCB’s API individual_profile_from_id service must be integrated
with the code below to programmatically identify individuals by age, or even identify individuals by family position status.
// contains resusable globals and functions
$apiService = 'individual_groups'; // CCB api service
$urlData = array_filter( array(
'srv' => "$apiService"
$rss = ccbDetails('get',$urlData); // transform to XML
$nodes = $rss->xpath('//individuals/individual'); // xpath for custom_fields/custom_field
$response_object = '';
$totalIndividualsCount = $totalGroupCount = 0;
$totalIndividualsCount = sizeof($nodes);
foreach ($nodes as $node)
// (See CCB API documentation for more $apiService fields)
$groups = $node->groups['count'];
$totalGroupCount += $groups;
$response_object .= '<p>'.$node->full_name.' ('.$groups.')</p>';
$average = $totalGroupCount / $totalIndividualsCount;
$averageGroups = number_format($average);
$averageGroupText = '<p>Average Number of Groups Per Person:'.$averageGroups.'</p>';
$response_object = $averageGroupText.$response_object;
There are quite a number of ways to expand this tutorial and report its data. Some of the reports that come to mind:
- Average group size
- Average group attendance
- Number of groups with X or more/less individuals
In closing, this tutorial scratches the surface of reporting tools to be developed focused on groups involvement.
That’s all for now! See you back here next week.