Quantcast
Channel: InfluxDB - Grafana Labs Community Forums
Viewing all articles
Browse latest Browse all 200

Transform -> Convert Field Type fails if my input is an "On"/"Off" string

$
0
0
  • What Grafana version and what operating system are you using?

Grafana v11.2.2 on a Raspberry Pi 5 Bookworm. Data source is InfluxDB on the same Pi.

  • What are you trying to achieve?

Ultimately a “logic analyser” time series view like Boolean values in Graph pannel - Grafana / Time Series Panel - Grafana Labs Community Forums, where each on/off input is graphed vertically offset from the others. I’m trying one step at a time and falling on the first hurdle.

  • How are you trying to achieve it?

I have multiple inputs I want to graph, and for each the query returns a String with values of “On” and “Off”.

I’m trying to convert “On” to the number 1 and “Off” to number 0, so I can then perform maths to add an offset to the value returned by each query, building the ‘layered’ logic analyser view in the example linked above.

  • What happened?

I’ve not had any success with Transform data / Convert field type. If I choose Number, the output is always ‘null’. As a test I also tried Boolean, and again, my results were always “true” even when the input was “Off”.

I couldn’t determine if Value Mappings are calculated before Data Transforms, and I also tried to map “On” to 1 and “Off” to 0 without success.

  • What did you expect to happen?

Ideally, “On” becomes numeral 1. From there I think my job is all downhill.

  • Can you copy/paste the configuration(s) that you are having problems with?

image

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

no errors.

  • Did you follow any online instructions? If so, what is the URL?

Lots, including a brief frustrating session with chatGPT.

Here’s the official documentation:
Transform data | Grafana documentation

I’ve also experimented with other Transforms, including ‘Add field from calculation’, and also trying to tweak the SQL query to add an “IF” or “CASE” to do the conversion ‘upstream’, but any attempts at those threw errors.

Am I approaching this wrong? TIA for any assistance.

10 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 200

Trending Articles