2.1 KiB
title | description | aliases | menu | weight | flux/v0.x/tags | introduced | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
highestCurrent() function | The `highestCurrent()` function selects the last record of each table in the input stream and returns the top `n` records. |
|
|
102 |
|
0.7.0 |
The highestCurrent()
function selects the last record of each table in the input stream and returns the top n
records.
The function outputs a single aggregated table containing n
records.
highestCurrent()
is a selector function.
highestCurrent(
n:10,
column: "_value",
groupColumns: [],
)
{{% warn %}}
Empty tables
highestCurrent()
drops empty tables.
{{% /warn %}}
Parameters
n
Number of records to return.
column
Column by which to sort.
Default is "_value"
.
groupColumns
The columns on which to group before performing the aggregation.
Default is []
.
tables
Input data.
Default is piped-forward data (<-
).
Examples
{{% flux/sample-example-intro %}}
import "sampledata"
sampledata.int()
|> highestCurrent(n: 2, groupColumns: ["tag"])
{{< expand-wrapper >}} {{% expand "View input and output" %}} {{< flex >}} {{% flex-content %}}
Input data
{{% flux/sample "int" %}}
{{% /flex-content %}} {{% flex-content %}}
Output data
_time | tag | _value |
---|---|---|
2021-01-01T00:00:50Z | t1 | 4 |
2021-01-01T00:00:50Z | t2 | 1 |
{{% /flex-content %}} {{< /flex >}} {{% /expand %}} {{< /expand-wrapper >}}