Nested function and single scalar value return

Dear all!

I am using a custom function, to find minimum inside custom start, stop interval.

functionToFindMinimum = (start, stop) => {  
    dataStream = from(bucket: "bucket")
        |> range(start: start, stop: stop)
        |> filter(fn: (r) => r["_measurement"] == "measurements")
        |> filter(fn: (r) => r["deviceId"] == "did123")
        |> filter(fn: (r) => r["_field"] == "Curr")
        |> drop(columns: ["_start", "_stop", "_time", "_field", "_measurement", "deviceId"])
        |> min()
    	|> toInt()

    return dataStream 
}

functionToFindMinimum(start: -2d, stop: -1d)

The result is a stream with single _value

How can i call this function inside map() …

......
    |> map(
        fn: (r) => (
            {
                d_minValue: functionToFindMinimum(start: r._FromTime, to: r._ToTime)
            }
            ),
    )

I do not know how to return single decimal/integer value from the function. Whatever i am trying it is always returning stream, so i am getting the following error:

 runtime error @43:8-52:6: map: map object property "d_minValue" is stream type which is not supported in a flux table

you result is not a scalar value, is a table with 1 result. use find column or find record to extract the scalar value…

Extract scalar values in Flux | InfluxDB OSS v2 Documentation (influxdata.com)

Thank you for you answer. Yes, i am returning a table, but i am unable to extract single scalar value.

The result is:
c8c250ae608ba158ec430900f46ff91df2f6f2be_2_690x90

I am trying with:
|> findColumn(fn: (key) => true, column: “_value”)

But i am always getting

runtime error @44:8-53:6: map: failed to evaluate map function: cannot access element 0 of array of length 0

Basically the same thing with |>findRecord. What am i doing wrong?