Command

When using TQL, we are always telling it to do something for us: show us a list of user inputs, count the number of times the Safetynet occurred, compute the number of sessions per day, etc. The action we tell TQL to take is what we call the command. The command is the most crucial part of a TQL query, as it tells TQL how to process and present the information that the query extracts from the session logs.

This query starts with a command: la, which is shorthand for listAll:

la s.id, t.e.userInput, t.e2.answerText:  t.e.userInput != "" limit 30 

These are the five commands that form the basis of TQL:

Command Abbreviated Form Return Value
listAll la list
listUnique lu list
countAll ca integer
countUnique cu integer
distribute d table

The command is an essential part of every TQL query. Without it, TQL doesn't know what to do. If you try a query without the command, you will receive a Query Failed message.

List all

The listAll function retrieves all values matching the query and returns a list.

Example Description
la t.e.userInput Lists all user inputs, including duplicates

List unique

The listUnique function retrieves all unique values matching the query and returns a list.

Example Description
lu s.id Lists all unique session ids
lu t.e.userInput Lists all user inputs, excluding duplicates

Count all

The countAll function counts all values matching the query and returns an integer.

Example Description
ca t.e.userInput Counts all user inputs

Count unique

The countUnique function counts all unique values matching the query and returns an integer.

Example Description
cu t.e.userInput Counts all unique user inputs, excluding duplicates
cu s.id Counts the number of dialogues / the number of unique sessions

Note: Uniqueness is determined by string comparison and is case sensitive.

Distribute

The distribute function counts the number of occurrences for all unique values matching the query and returns a 2-column table of unordered counts.

Example Description
d t.e.userInput Shows a distribution of occurrences of each unique user input (including empty values)

Was this page helpful?