grafana / grafana-json-datasource

A data source plugin for loading JSON APIs into Grafana.
Apache License 2.0
270 stars 66 forks source link

Can't perform basic math with JSONata #405

Closed Max-E-Million closed 9 months ago

Max-E-Million commented 10 months ago

Hello,

I am trying to do add two JSONata fields together but it seems I am doing something wrong. I have boiled it down to not being able to do some baisc math:

JSON-Data: [{"number":"20"}]

grafik

Changing the Type to "Number" also doesn't change anything. Why isn't this working?

yesoreyeram commented 9 months ago

It looks like your "number" field is actual string. So you may need some sort of conversion. something like $map($,function($v){ return { "number": $number($v.number) - 5 }}). Potentially there can be better JSONata syntax.

image