UQL query using Dashboard Time Interval

Hello

I have this sample inline data

[
    {
        "start time": "2024:08:01",
        "end time": "2024:08:01",
        "value": 3202,
      
    },
    {
        "start time": "2024:08:01",
        "end time": "2024:08:01",
        "value": 8068,
    },
    {
        "start time": "2024:08:01",
        "end time": "2024:08:01",
        "value": 4965,
    }
]

I am using UQL to parse this data. I want to parse it in such a way that I use the dashboard time interval in order to display the data that matches the time interval. Can someone help me? I am stuck here.

Do you retrieve the JSON object via a URL, and if yes, can you modify that URL to reflect the values in the Time Picker?

For example, in this URL, the FROM and TO dates are contained in the URL:


(t is time and is represented in Unix time)

Modifying the same URL for Infinity / Grafana to reflect the Time Picker values, we can write like this:
https://api.marketdata.app/v1/stocks/candles/D/AAPL/?from=${__from:date:YYYY-MM-DD}&to=${__to:date:YYYY-MM-DD}

Can you do something similar using your URL?

Like I am not using a URL to get the data, for temporary measure I am using inline data and uql to parse it, so I wanted to know if this kind of manipulation is possible in the UQL?

Can you share the UQL query that you have created thus far?

parse json
| where “start_time” >= “${__from:date:YYYY-MM-DD}”
| project “value”

Start time value I can change it to unix epoch if needed

is your date format really YYYY:MM:DD?

try filtering using jsonata

https://try.jsonata.org/L5t-9gyUk

2 Likes