This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
MIN
Dan Gorman edited this page Nov 29, 2018
·
2 revisions
MIN
returns the minimum value in a numeric dataset.
MIN(arg1, [arg2...])
-
arg1
can be a number, string or an array of numbers or strings (or anything that can be coerced into being a number) -
arg2
is optional, and has the same restrictions asarg1
-
MIN
also takes an arbitrary number of additional arguments
Let's say we're given a response with some vehicle information that looks like this:
{
"data":{
"local_service_prices":{
"highest_rated":160,
"nearest":120,
"regional":[
140,
90,
115,
220
]
}
}
}
If we want to find the smaller of the nearest and highest rated service stations, we can just use MIN
:
MIN(data.local_service_prices.highest_rated, data.local_service_prices.nearest)
This would return 120
.
MIN
can also take arrays as arguments.
MIN(data.local_service_prices.highest_rated, data.local_service_prices.nearest, data.local_service_prices.regional) => 90