We are often interested in viewing data over time, to identify trends. How did our bot's conversations develop over weeks or months? Transformers are a group of TQL functions that make it easier to query dates and trends. They perform background computations that deliver new data values that you can display or query. Transformers appear as part of a query's constraint, and the transformed values can be used as part of the selection. There are two types of transformers used by TQL:
Our focus here is on date transformers. For information about trends, check the TQL Reference Guide and the TQL Cookbook.
Date transformers allow you to organize events by different periods of time. They use the TQL function catd which allows you to specify one or both of the following:
date
day-of-week
month
quarter
yyyy-MM-dd
kk
yyyy-'w'ww
Optional parameters allow you to specify a time zone or Java Locale. Please refer to the manual for more detail.
Let's look at a sample query that shows the number of conversations per day that occurred during business hours. Notice that you can format and also comment your queries to make them easier to read.
d date:
catd(model="date") s.beginTime as date, // tells TQL to organize the results by unique dates
catd(pattern="HH") s.beginTime as hour, // tells TQL to make hour available in the query
hour == in {"09".."18"} // constraint to only show sessions during these hours
order by date
Here you see the results sorted by date. The first column shows the date, the second, the number of sessions during business hours. This information could also be fed into a dashboard, where it is converted to a graph.
Was this page helpful?