{min:val1:val2:...}

Description

Returns the smallest of the supplied numbers. Give the values either colon-separated (min:12:45:8) or as a single JSON array (min:[12,45,8]). Values are read as numbers, so a comma decimal like 1,5 is treated as 1.5 and surrounding spaces are ignored. With no values the result is empty; with one value that value is returned unchanged; with two or more the lowest is returned. Negative and decimal values are supported. The sibling commands are max (largest) and avg (average).

Parameters

val1:val2:... optional

One or more numbers to compare, given colon-separated (12:45:8) or as a single JSON array ([12,45,8]). Each value is read as a number, so a comma decimal (1,5) becomes 1.5 and surrounding spaces are ignored. Empty positions are skipped. With no values the output is empty; with one value it is returned unchanged.

Examples

test{min:1,5:2:3}
Expected1.5
Actual1.5
A comma is accepted as the decimal separator (common in Czech and other locales). 1,5 is read as 1.5, which here is the smallest.
test{min:2.5:5:8}
Expected2.5
Actual2.5
Decimals are compared numerically and the result keeps its decimal part.
test{min:[12,45,8]}
Expected8
Actual8
The same values can be passed as one JSON array. Useful when the list is already JSON, e.g. from definejson or a multi-value field.
test{min:-4:-9:2}
Expected-9
Actual-9
Negative values work as expected; the most negative number is the smallest.
test[{min:}]
Expected[]
Actual[]
With nothing to compare the result is an empty string. The square brackets here are just literal text around the command, shown so the empty result is visible.
test{min:42}
Expected42
Actual42
With only one value there is nothing to compare, so that value is returned unchanged (read as a number).
test{min:12:45:8}
Expected8
Actual8
The basic form: list the numbers separated by colons. min returns the lowest one.