Query expression math to convert value

Morning,
I tried this weekend to convert values in kelvin to celcius, using EXPRESSION, and I don’t understand, when I enter the formula, I have the datas which disappears from the dashboard.
I have tried different syntax on formula, same.
Grafana gives me an error that I don’t know how to interpret.



Check doc:

Are you sure that refid of your first query is temp? I guess it is A, when expression itself has B (but I can be wrong, because you didn’t show that):

Ha Ok, expression math only between refid. Yes my first query is A
I didn’t find anything in the transformation options, but maybe I didn’t understand
In this case what should I use to do temp-273.15, temp_min-273.15, temp_max-273.15 (convert Kelvin value to Celsius values)

my json

{
“coord”: {
“lon”: 3.8036,
“lat”: 45.9435
},
“weather”: [
{
“id”: 804,
“main”: “Clouds”,
“description”: “overcast clouds”,
“icon”: “04n”
}
],
“base”: “stations”,
“main”: {
“temp”: 280.29,
“feels_like”: 280.29,
“temp_min”: 278.76,
“temp_max”: 280.29,
“pressure”: 1033,
“humidity”: 84,
“sea_level”: 1033,
“grnd_level”: 952
},
“visibility”: 10000,
“wind”: {
“speed”: 1.15,
“deg”: 263,
“gust”: 1.31
},
“clouds”: {
“all”: 100
},
“dt”: 1708282030,
“sys”: {
“type”: 2,
“id”: 2038399,
“country”: “FR”,
“sunrise”: 1708238637,
“sunset”: 1708276433
},
“timezone”: 3600,
“id”: 2979009,
“name”: “Saint-Just-en-Chevalet”,
“cod”: 200
}

Please post proper json formatted data. Did you try to do it with jsonata?

the following should help you

Hi, I continue my experimentation through my needs.

maybe that’s where I’m wrong, I send my API to Json viewer online, and I recover the text formatted . I do not have anything else.

Yes but not easy for me,I’m trying to understand string expression in my context, but this is all unfamiliar to me.
It is not really my job.

It is not my job either. It was totally unfamiliar to me also until you asked the question

I read the documentation posted and kept trying it and voila. Un peux d’effort de ta par

Answer is here

$ ~> |Account.Order.Product|{‘Total’: Price * Quantity}, [‘Price’, ‘Quantity’]|

Copy your posted json data to
https://try.jsonata.org/

And try the transform function from the documentation

1 Like

You are terrible :cold_face: :wink:
So I think to have found , my json is not standard, because not correctly double quoted


I have remplace it by " in excel, and it is OK now.

do you have an idea about this problem ???
I continue to implant this in grafana…thank’s

:wink:
Good progress! So what is your question?

Why my initial json is not correctly doublequoted ??? look my picture with red waves…

Wrong quotation mark styles. Zoom in

no I can’t put it in grafana.
I tried with Transform data and Add field from calculation, it works, but when I switch “replace all fields” marker on map disappears

So if you choose “replace all fields” then it will replace all fields and get rid of your locatiomln data in fact all data except the transformed data. So that is to be expected

I didn’t get there, so I got around the problem, by keeping the Kelvin degrees, and adding the Celcius degrees.
I continue my exploration…

1 Like