Show only latest sessions

I wrote and saved some queries to show recent sessions, but it’s always necessary to adjust them for the current date. I am using similar constraints as shown in the TQL cookbook. So today, to show the latest sessions I have:

s.beginTime == in {“2020-03-20”…“2015-03-25”}

If I use this next week, I have to adjust the dates first. Is there a generic way to show only recent sessions without changing the query each time?

Hello Clara! I’m happy to tell you that some new functionality in TQL allows exactly what you are looking for. Unfortunately this is not yet documented on the reference pages but we will have it corrected soon.

In the constraint you specify a time unit relative to the current date and time, and then a different time unit that you’d like to display. In practice, a query to show all sessions during the current week looks like this:
la s.beginTime == in {"now-0w/w"}

You can read it like this: “relative to now, go back 0 weeks, then show that entire week.:”

To show last week’s session you write it like this:
la s.beginTime == in {"now-1w/w"}

Reads as “relative to now, go back 1 week, and show that entire week.”

You can do the same for months. To show last month’s sessions try:
la s.beginTime == in {"now-1M/M"}

This query would show you all the sessions occurring 3 hours earlier than the current hour:
la s.beginTime == in {"now-3h/h"}

If you want to pull up the sessions of the ongoing hour, you can use this:
la : s.beginTime == in {"now-0h/h"}

I hope this helps! Have fun exploring the queries!

1 Like