Dashboad datetime picker issues with mysql DB

  • What Grafana version and what operating system are you using?
    Version 11.2.0
  • What are you trying to achieve?
    Create a dashboard with time series chart and user able to pick a datetime range from the dashboard
  • How are you trying to achieve it?
    Using global var like $__Timefrom() & $__Timeto() in the query
  • What happened?
  1. line chart did not display but table view with data available. (where Dt_STAMP between $__timeFrom() and $__timeTo())
  2. Using constant datetime in query, it is able to work (where Dt_STAMP between ‘2024-09-09 01:00:00’ and ‘2024-09-09 02:30:00’ )
  • What did you expect to happen?
    the query execute with the datetime selected by user in the datetime picker. Like a dynamic variable.

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

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

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

are you including the timestamp in your query, not just filtering on it?

can you share you sql statement?

Hi sowdenraymond,
Thanks for your reply. Yes i did include timestamp in my query.
Here is the sql statement that having problem:
SELECT Dt_STAMP, TB, STN_NO, LOAD_FORCE_BOTTOM, LOAD_FORCE_TOP
FROM tableau.TB_KPI
WHERE Dt_STAMP between $__timeFrom() and $__timeTo()
AND TB_Type = ${tb_type:sqlstring}
AND TB = ${tb_machine:sqlstring}
AND STN_NO = ${station_no:sqlstring};

can you share the value of Dt_STAMP?

Hi, Here is how Dt_STAMP look like.–> “2024-09-10 09:00:17”
Below is the print screen.
image