Return the maximum value of the given field in this DataList

@param string $field Unquoted database column name. Will be ANSI quoted
automatically so must not contain double quotes.
@return string
18162
public function max($field)
    {
        $table = DataObject::getSchema()->tableForField($this->dataClass, $field);
        if (!$table) {
            return $this->aggregate("MAX(\"$field\")");
        }
        return $this->aggregate("MAX(\"$table\".\"$field\")");
    }
414810
public function getScalar($field = null)
	{
		$option = $this->operationOption;
		$this->__getScalarBefore($option);
		if(null !== $field)
		{
			$this->operationOption['field'] = array($field);
		}
		$this->db->operationOption = $this->getOption();
		$result = $this->db->getScalar();
		$this->__getScalarAfter($result,$option);
		return $result;
	}
540510
public static function getField($field)
    {
        return isset(self::$fields[$field]) ? self::$fields[$field] : null;
    }
429153
public function getField($field)
    {
        return isset($this->data[$field])
            ? $this->data[$field]
            : $this->searchField($field);
    }
1318355
public function max($column)
	{
		is_array($column) and $column = array_shift($column);

		// Get the columns
		$columns = \DB::expr('MAX('.
			\Database_Connection::instance($this->connection)->quote_identifier($this->alias.'.'.$column).
			') AS max_result');

		// Remove the current select and
		$query = \DB::select($columns);

		// Set from table
		$query->from(array($this->_table(), $this->alias));

		$tmp   = $this->build_query($query, $columns, 'max');
		$query = $tmp['query'];
		$max   = $query->execute($this->connection)->get('max_result');

		// Database_Result::get('max_result') returns a string | null
		if ($max === null)
		{
			return false;
		}

		return $max;
	}
440470
public function getMaxLength($field)
    {
        $parts = explode('.', $field);
        $validator = $this->_getValidator($parts);
        $fieldName = array_pop($parts);
        if (!$validator->hasField($fieldName)) {
            return null;
        }
        foreach ($validator->field($fieldName)->rules() as $rule) {
            if ($rule->get('rule') === 'maxLength') {
                return $rule->get('pass')[0];
            }
        }

        return null;
    }
1267416
public function getEntityAttributeValue($field)
    {
        if ($field) {
            $functionName = 'get'.ucfirst($field);

            // Avoid error when the widget refer to a property that has been removed
            if (!method_exists($this, $functionName)) {
                return;
            }

            $fieldValue = $this->{$functionName}();
        } else {
            $fieldValue = null;
        }

        return $fieldValue;
    }
448929
public function getValFormatted($field)
    {
        if ($this->validate($field)) {
            $value = $field->valRaw();
            $dateArray = $this->getDateArray($value);
            return \sprintf('%04d-%02d-%02d', $dateArray['year'], $dateArray['mon'], $dateArray['mday']);
        }
        return null;
    }
579696
public function getInvalidField($field)
    {
        $value = isset($this->_invalid[$field]) ? $this->_invalid[$field] : null;

        return $value;
    }
967541
protected function _getMax()
    {
        $field = $this->_config['right'];
        $rightField = $this->_config['rightField'];
        $edge = $this->_scope($this->_table->find())
            ->select([$field])
            ->orderDesc($rightField)
            ->first();

        if (empty($edge->{$field})) {
            return 0;
        }

        return $edge->{$field};
    }
1026868
public function count($field='*')
    {
        $this->getQuery()->type('select')->remove('fields')->set('count', $field);
        
        $result = $this->query();
        
        if ($result) {// get first row's value
            $result = current($result[0]);
        } else {
            $result = 0;
        }
        
        return $result;
    }
1278870
public function getField($field)
    {
        // If we already have a value in $this->record, then we should just return that
        if (isset($this->record[$field])) {
            return $this->record[$field];
        }

        // Do we have a field that needs to be lazy loaded?
        if (isset($this->record[$field . '_Lazy'])) {
            $tableClass = $this->record[$field . '_Lazy'];
            $this->loadLazyFields($tableClass);
        }
        $schema = static::getSchema();

        // Support unary relations as fields
        if ($schema->unaryComponent(static::class, $field)) {
            return $this->getComponent($field);
        }

        // In case of complex fields, return the DBField object
        if ($schema->compositeField(static::class, $field)) {
            $this->record[$field] = $this->dbObject($field);
        }

        return isset($this->record[$field]) ? $this->record[$field] : null;
    }
1028485
public function getValue($field) {
        if (is_array($this->values)) {
            return isset($this->values[$field]) ? $this->values[$field] : null;
        }
        if (is_object($this->values)) {
            return $this->values->$field;
        }
        return null;
    }
830316
public function values($field)
    {
        $values = [];
        foreach ($this->queries as $query) {
            $t = $query->values($field);
            /** @noinspection SlowArrayOperationsInLoopInspection */
            $values = array_merge($values, $t);
        }

        return array_values(array_unique($values, SORT_REGULAR));
    }
959844
public function getDefaultValueDeclarationSQL($field)
    {
        if (! isset($field['default'])) {
            return empty($field['notnull']) ? ' DEFAULT NULL' : '';
        }

        $default = $field['default'];

        if (! isset($field['type'])) {
            return " DEFAULT '" . $default . "'";
        }

        $type = $field['type'];

        if ($type instanceof Types\PhpIntegerMappingType) {
            return ' DEFAULT ' . $default;
        }

        if ($type instanceof Types\PhpDateTimeMappingType && $default === $this->getCurrentTimestampSQL()) {
            return ' DEFAULT ' . $this->getCurrentTimestampSQL();
        }

        if ($type instanceof Types\TimeType && $default === $this->getCurrentTimeSQL()) {
            return ' DEFAULT ' . $this->getCurrentTimeSQL();
        }

        if ($type instanceof Types\DateType && $default === $this->getCurrentDateSQL()) {
            return ' DEFAULT ' . $this->getCurrentDateSQL();
        }

        if ($type instanceof Types\BooleanType) {
            return " DEFAULT '" . $this->convertBooleans($default) . "'";
        }

        return ' DEFAULT ' . $this->quoteStringLiteral($default);
    }
824540
public function getMaxValue()
    {
        if (!$this->isNumeric()) {
            return null;
        }
        $dataType = $this->getEloquentDataMethod();
		$max = 2147483647;

        if ($this->isDecimal()) {
            $length = $this->getMethodParam(0) ?: 1;
            $declimal = $this->getMethodParam(1) ?: 0;
            $max = str_repeat('9', $length);

            if ($declimal > 0) {
                $max = substr_replace($max, '.', $declimal * -1, 0);
            }
            $max = floatval($max);
        } elseif ($dataType == 'integer' || $dataType == 'increments') {
            $max = $this->isUnsigned ? 4294967295 : 2147483647;
        } elseif ($dataType == 'mediumInteger' || $dataType == 'mediumIncrements') {
            $max = $this->isUnsigned ? 16777215 : 8388607;
        } elseif ($dataType == 'smallInteger' || $dataType == 'smallIncrements') {
            $max = $this->isUnsigned ? 65535 : 32767;
        } elseif ($dataType == 'tinyInteger' || $dataType == 'tinyIncrements') {
            $max = $this->isUnsigned ? 255 : 127;
        } elseif ($dataType == 'bigInteger' || $dataType == 'bigIncrements') {
            $max = $this->isUnsigned ? 18446744073709551615 : 9223372036854775807;
        }

        return $max;
    }
714998
public static function quoteField($field) {
        $trimmedField = trim($field);
        if ($trimmedField == '*') {
            return $trimmedField;
        }

        if (strpos($trimmedField, ' ') !== false) {
            return $trimmedField;
        }

        return strpos($trimmedField, '.') !== false ?
                $trimmedField : "`{$trimmedField}`";
    }