docs-v2/content/v2.0/reference/flux/functions/outputs/yield.md

46 lines
1.2 KiB
Markdown

---
title: yield() function
description: The yield() function indicates the input tables received should be delivered as a result of the query.
menu:
v2_0_ref:
name: yield
parent: Outputs
weight: 1
---
The `yield()` function indicates the input tables received should be delivered as a result of the query.
Yield outputs the input stream unmodified.
A query may have multiple results, each identified by the name provided to the `yield()` function.
_**Function type:** Output_
_**Output data type:** Object_
```js
yield(name: "custom-name")
```
{{% note %}}
`yield()` is implicit for queries that do only one thing and are only needed when using multiple sources in a query.
With multiple sources, `yield()` is required to specify what is returned, and what name to give it.
{{% /note %}}
## Parameters
### name
A unique name for the yielded results.
Defaults to `"_results"`.
_**Data type:** String_
## Examples
```js
from(bucket: "telegraf/autogen")
|> range(start: -5m)
|> yield(name: "1")
```
<hr style="margin-top:4rem"/>
##### Related InfluxQL functions and statements:
[SELECT AS](https://docs.influxdata.com/influxdb/latest/query_language/data_exploration/#the-basic-select-statement)