Skip to main content

nearest

nearest finds the nearest object to at least one member of a specified group. It also accepts a filter to further restrict the valid results. It ignores self matches, so an object is not considered to be close to itself, but if the input and

ContextType
Inputset of objects
Outputa set with a single object

Examples

Finds

    when
object(type="bicycle", battery<20)
then
nearest(type="van").sendToUrl("http://localhost:${port}/${path}")

This example first finds bicycles with low battery, then finds a single van that is nearest to one of them.

Notes

The function nearest operates on multiple objects, but returns a single object.