AnsweredAssumed Answered

How to make a field return the results of an sql query

Question asked by Aleksey Azanyan on Oct 16, 2016

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.