Problem with Infinity UQL Query

Hello, I’m new here in the forum.

I’m currently trying to implement a query but I’m still missing some background information.
I got the following result from a query and would like to format it.
In particular, i want to “unpack” the timeStampDays and ddaT_DVAL arrays to display them in a table or visualization. I tried it with UQL but without success.

This the structur:

{
“httpStatusCode”: 200,
“httpStatusCodeMessage”: “OK”,
“resultType”: “DayDataResult”,
“result”: {
“hasData”: true,
“pvCount”: 2,
“timeStampsCount”: 3,
“timeStampDays”: [
“2024-11-25”,
“2024-11-26”,
“2024-11-27”
],
“timeStamps_FORMATTED”: [
“25.11.2024”,
“26.11.2024”,
“27.11.2024”
],
“data”: [
{
“pvid”: 302000024,
“shortName”: “DS70IL001”,
“ddaT_DVAL”: [
268.84668542357855,
268.8477531491359,
268.2567145610395
],
“ddaT_DVAL_FORMATTED”: [
“269”,
“269”,
“268”
]
},
{
“pvid”: 302000025,
“shortName”: “SW30IL002”,
“ddaT_DVAL”: [
272.2857371354309,
272.3211246863265,
271.9221165855243
],
“ddaT_DVAL_FORMATTED”: [
“272”,
“272”,
“272”
]
}
]
}
}

Please share the uql you tried

parse-json
| scope “result”
| mv-expand “data”
| project “data”
| mv-expand “ddaT_DVAL”
| project “ddaT_DVAL”, “timeStampDays”

It is much easier with backend & jsonata query.

$map($.result.data, function($data){
    $map($data.ddaT_DVAL, function($ddaT_DVAL,$ddaT_DVAL_index){
        {
            "date": $.result.timeStampDays[$ddaT_DVAL_index],
            "pvid": $string($data.pvid),
            "shortName": $data.shortName,
            "ddaT_DVAL": $ddaT_DVAL
        }
    })
}).*^(date)

https://play.grafana.org/goto/nb98v4VNg?orgId=1

In order to make this proper timeseries, set the format to timeseries in query

1 Like

Thank you very much. It works perfectly now.