Is it possible to format resulting numbers?

marun
Tue, 20 Aug 2024 14:32:05 +0000
Systems

Hi, I’m querying InfluxDB OSS 2.7 with this query

from(bucket: "fve")
  |> range(start: -1m, stop: now())
  |> filter(fn: (r) => r["_measurement"] == "realtime")
  |> filter(fn: (r) => r["_field"] == "Batpower_Charge1" or
                       r["_field"] == "Battery_Capacity" or
                       r["_field"] == "feedin_power" or
                       r["_field"] == "FeedinPower_Tphase" or
                       r["_field"] == "FeedinPower_Sphase" or
                       r["_field"] == "FeedinPower_Rphase")
  |> mean()
  |> pivot(rowKey: ["_stop"], columnKey: ["_field"], valueColumn: "_value")
  |> map(fn: (r) => ({r with time: uint(v: r._stop) / uint(v: 1000000000)}))
  |> drop(columns: ["result", "_start", "_stop", "_measurement"])

and i get this response

,result,table,Batpower_Charge1,Battery_Capacity,FeedinPower_Rphase,FeedinPower_Sphase,FeedinPower_Tphase,feedin_power,time
,_result,0,0,98,350.45,350.78333333333336,351.9,1054,1724162788

I have several questions.

why there is leading comma? this creates empty column when parsing

why I can’t get rid of result and table columns?

I’m querying from system with limited resources and standard float number parsing takes a lot of flash and is akward to use. Is it possible constrain format of these numbers (for example scientific notation with fixed number of mantissa digits) i could then create simple custom parser.

10 posts - 2 participants