I probably miss something but I can’t make the FindRecord()
Following the example here :
import "sampledata"
sampledata.int()
|> findRecord(
fn: (key) => key.tag == "t1",
idx: 0,
)
I got the error :
error in query specification while starting program: this Flux script returns no streaming data. Consider adding a "yield" or invoking streaming functions directly, without performing an assignment
What do I miss ?
InfluxDB 2.7 Open Source
Hello @gmassart,
Thank you for including sampledata.
I prefer to get that function working using filters and then setting to true because I find it easier to read:
import "array"
import "sampledata"
myExtractedVal = sampledata.int()
|> filter(fn: (r) => r.tag == "t1")
|> findRecord(fn: (key) => true, idx: 0)
array.from(rows: [{test: myExtractedVal._value}])
But also that is the same as:
import "sampledata"
import "array"
myExtractedVal = sampledata.int()
|> findRecord(fn: (key) => key.tag == "t1", idx: 0)
array.from(rows: [{test: myExtractedVal._value}])
In this case since you only have one tag value in that dataset 
Thank you
I missed the fact you needed the array function to output a table that’s why I always get the error, was not storing the row into the object to get it after.
Thank you for your support !
1 Like