Function Reference > Functions > MIN (String)
  

MIN (String)

Returns the lowest string value found in a field or group. You can apply a filter to limit the rows in the search.
Note: The MIN function uses the same sort order that the Sorter transformation uses. However, the MIN function is case sensitive, but the Sorter transformation may not be case sensitive.
You can also use MIN to return the latest date or the minimum numeric value in a field or group.
You can nest only one other aggregate function within MIN, and the nested function must return a string data type. You cannot nest aggregate functions in an elastic mapping.
Use only in mapping tasks.

Syntax

MIN( string [, filter_condition] )
Argument
Required/
Optional
Description
string
Required
String data type. Passes the values for which you want to return minimum value. You can enter any valid transformation expression.
filter_condition
Optional
Limits the rows in the search. The filter condition must be a numeric value or evaluate to TRUE, FALSE, or NULL. You can enter any valid transformation expression.

Return Value

String value.
NULL if all values passed to the function are NULL, or if no rows are selected (for example, the filter condition evaluates to FALSE or NULL for all rows).

Nulls

If a single value is NULL, MIN ignores it. However, if all values passed from the field are NULL, MIN returns NULL.

Group By

MIN groups values based on group by fields you define in the transformation, returning one result for each group.
If there is no group by field, MIN treats all rows as one group, returning one value.

Example

The following expression returns the minimum item name for manufacturer ID 104:
MIN ( ITEM_NAME, MANUFACTURER_ID='104' )
MANUFACTURER_ID
ITEM_NAME
101
First Stage Regulator
102
Electronic Console
104
Flashlight
104
Battery (9 volt)
104
Rope (20 ft)
104
60.6 cu ft Tank
107
75.4 cu ft Tank
108
Wristband Thermometer
RETURN VALUE: 60.6 cu ft Tank