Add a custom field to a query

I am trying to make a combined query, assigning a value to a variable and passing it to the main query. I think it is due the result type of the first query, that is not a simple string.

desc = v1.tagValues(
    bucket: "telemetry",
    tag: "/interfaces/interface/subinterfaces/subinterface/state/description",
    predicate: (r) => r["device"] == "cpr1" and r["interface_name"] == "${core_int}" and r["subinterface_index"] == "3000",
    start: -1d

from(bucket: "telemetry")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "/interfaces/")
  |> filter(fn: (r) => r["_field"] == "/interfaces/interface/subinterfaces/subinterface/state/counters/in-octets")
  |> filter(fn: (r) => r["device"] == "${device}")
  |> filter(fn: (r) => r["interface_name"] == "${core_int}")
  |> map(fn: (r) => ({r with _value: r._value * 8}))
  |> derivative(nonNegative: true, unit: 1s)
  |> set(key: "_field", value: "input")
  |> set(key: "_desc", value: "${desc}")

Error received:
invalid: error @22:34-22:38: stream[{A with _value: B, _value: string}] is not Stringable

Hello @Guilherme_Ladvocat,
I recommend yeilding desc to get an understanding for what type it is.
It’s a table.
You can extract a single record:

desc  = schema.tagValues(bucket: "airSensors", tag: "sensor_id",
predicate: (r) => r["_measurement"] == "airSensors",
start: -1y
|> findRecord(
        fn: (key) => true,
        idx: 0,


Then you cold pass it into your subsequent query.

Hi @Anaisdg,

When I do a query with the ‘findRecord’ function, I receive this message:
“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”

And when I do without it, I see data, but in a table.