I'm not clear on what you want to do. If you just want the count of resources that have that TV:
$tvId = 12;
$total = $modx->getCount('modTemplateVarResource', array('tmplvarid' => $tvId));
If you want the number of those TVs that hold a particular value, it would be:
$tvId = 12;
$value = 'somevalue'
$total = $modx->getCount('modTemplateVarResource', array('tmplvarid' => $tvId, 'value' => $value));
If you need to get the Resources (or Resource ID's) for the Resources that have the particular value for the TV, you'd have to use getCollection():
$tvID = 12
$value = 'somevalue'
$tvrs = $modx->getCollection('modTemplateVarResource', array('tmplvarid' => $tvId, 'value' => $value));
foreach ($tvrs as $tvr) {
$resourceId = $tvr->get('contentid');
$doc = $modx->getObject('modResource', $resourceId);
if ($doc) {
$fields = $doc->toArray();
echo 'Pagetitle: ' . $fields['pagetitle'];
// etc.
}
}
You could probably do the last one in a single query with a join or with getCollectionGraph() but I'm too tired to figure out the code.