можно взять готовое решение из модуля совместимости с 5-кой
function GetCountInformationSystemItem($information_system_id = FALSE, $information_group_id = FALSE, $property = array())
{
$queryBuilder = Core_QueryBuilder::select(array('COUNT(*)', 'count'))
->from('informationsystem_items')
->where('deleted', '=', 0);
if ($information_system_id !== FALSE)
{
$queryBuilder->where('informationsystem_id', '=', intval($information_system_id));
}
if ($information_group_id !== FALSE)
{
$queryBuilder->where('informationsystem_group_id', '=', intval($information_group_id));
}
$current_date = date('Y-m-d H:i:s');
$queryBuilder
->where('start_datetime', '<=', $current_date)
->open()
->where('end_datetime', '>=', $current_date)
->setOr()
->where('end_datetime', '=', '0000-00-00 00:00:00')
->close()
->where('active', '=', 1);
$row = $queryBuilder->execute()->asAssoc()->current();
return $row['count'];
}