Browse Source

add 'count' to cumstomsummarypage 'calc'

Kano 13 years ago
parent
commit
868510365f
2 changed files with 6 additions and 1 deletions
  1. 4 1
      README.RPC
  2. 2 0
      miner.php

+ 4 - 1
README.RPC

@@ -1401,9 +1401,12 @@ You can only see fields listed in 'group' and 'calc'
 
 
 A 'calc' is formatted as: 'Field' => 'function'
 A 'calc' is formatted as: 'Field' => 'function'
 The current list of operations available for 'calc' are:
 The current list of operations available for 'calc' are:
-'sum', 'avg', 'min', 'max', 'lo', 'hi', 'any'
+'sum', 'avg', 'min', 'max', 'lo', 'hi', 'coount', 'any'
 The first 4 are as expected - the numerical sum, average, minimum or maximum
 The first 4 are as expected - the numerical sum, average, minimum or maximum
 'lo' is the first string of the list, sorted ignoring case
 'lo' is the first string of the list, sorted ignoring case
 'hi' is the last string of the list, sorted ignoring case
 'hi' is the last string of the list, sorted ignoring case
+'count' is the number of rows in the section specified in the calc e.g.
+ ('DEVS.Name' => 'count') would be the number of DEVS selected in the 'where'
+ of course any valid 'DEVS.Xyz' would give the same 'count' value
 'any' is effectively random: the field value in the first row of the grouped data
 'any' is effectively random: the field value in the first row of the grouped data
 An unrecognised 'function' uses 'any'
 An unrecognised 'function' uses 'any'

+ 2 - 0
miner.php

@@ -2109,6 +2109,8 @@ function docalc($func, $data)
 			if (strcasecmp($val, $ans) > 0)
 			if (strcasecmp($val, $ans) > 0)
 				$ans = $val;
 				$ans = $val;
 	return $ans;
 	return $ans;
+ case 'count':
+	return count($data);
  case 'any':
  case 'any':
  default:
  default:
 	return $data[0];
 	return $data[0];