@eloparco, what version of InfluxDB are you using? What version of Flux are you running? To see your Flux version, run the following in your Data Explorer:
One thing to note is that the Data Explorer and dashboard cells cannot display scalar values. They only support streams of tables, so if you’re trying to display this in a cell, it needs to inside a stream of tables. You could do something like:
Thanks, putting array.from(rows: [{ _value: int(v: tot_scalar) }]) works as expected.
What still doesn’t work in my case is:
tot = my_table
|> sum(column: "session_id")
|> findColumn(fn: (key) => true, column: "session_id")
tot_scalar = tot[0]
my_table // <------- An internal error has occurred
Here I get the error just because I added my_table at the end.
Or (what I would like to do in reality):
tot = my_table
|> sum(column: "session_id")
|> findColumn(fn: (key) => true, column: "session_id")
tot_scalar = tot[0]
my_table |> map(fn: (r) => ({ r with _value: float(v: r.session_id) / float(v: tot_scalar) * 100.0 })).
// An internal error has occurred
With your minimal example, these two scenarios work fine while in my case they don’t.
I obtain my_table after some transformations (join between a timeseries and SQL data + some processing). But I don’t get why this is happening since the raw data representation is the one I put in the screenshot (and that you reproduced using array).
With your query above, my_table doesn’t resolve to a stream of tables; it resolves to an array. findColumn() returns an array of values in the specified column. The Data Explorer can’t display an array. To do what you’re hoping to do, you need to restructure your query a bit: