Using today's date in a TQL query

I have a query which I use to monitor traffic rates and liveness:

d t.time, t.e.fname: t.e.pathType == ‘flow-trigger’, t.time > ‘2022-12-01’ order by t.time desc

which I keep updating each day. I would like to use the equivalent of selecting now() or today() from a SQL database

I have looked at Teneo Query Language (TQL) | Reference documentation | Teneo Developers but cannot see it.

Hi Kate!

If I understood correctly, the now() function will provide the following data: YYYY-MM-DD HH:MM:SS. So I consequently understood you want this TQL query to automatically recognized the date and time so, each time you manually run it, you can obtain some results without the necessity of updating the day. My question about the results are the following:

  • Will you be searching a passed day? For example, on Friday you will be extracting Thursday’s traffic.
  • Or will you search today’s latest traffic? For instance, the same Friday you run the query.

I will provide you additional information based on your previous answer, but in the meantime and just in case you want to keep investigating it, you could make use of the Inquire API to automatize this daily process.

Hi Sofia, thanks for the fast reply. Yes, my idea was to use the current day as I run this report as part of my daily checks i.e. if I ran it today, I would want all results from 00:01 2/12/22.

I am also looking at integrating the report via the Teneo API into our AWS which is why it needs to use something like now().

Thanks

Kate

Hi Kate,

Thank you so much for clarifying. First of all here is the documentation section where you can select how to use the relative dates on TQL.
Secondly, here is the changed I made in your query so you will be able to extract the data for the on-going day:

d t.time, t.e.fname: 
t.e.pathType == ‘flow-trigger’, 
s.beginTime == in{"now/d"} 
order by t.time desc

Keep in mind that this will extract data from today. You can and should review the hours option in case you want to extract periods of 24 hours or so.
Hope this helps!