I can write the query, however what I need is to have a field which does a count of another module, of all entries which share a client_id.
So how can I make a field return a function?
The function as I imagine it would be something like...
$returnName = $this->bean->name;
$sqlClientCallNumber = ("SELECT COUNT(call_record_c) AS NumberOfCalls FROM calls_cstm WHERE client_id_c = '$returnName'");
$resultClientCallNumber = $GLOBALS['db']->getOne($sqlClientCallNumber);
where I want $resultclientcallnumber for each individual account entry to be the resulting count.