About the Object item
The first required item for a query is the object item against which you are querying. The object items are found in the output of the DataModelSamples PowerShell sample. You provide the object type in quotes, such as the following: For("EmailMessage"). This part of the query is required for both object and aggregate query types.
About the Time clause
The next step in the query is to establish the time slice to which you want to limit your query. You add the time clause as an explicit item so that you do not need to include the time clause in the main Where clause. The list of supported time clauses is as follows:
For classes that require a date value, all dates must be UTC date/times. The best way to establish the date is to use the following two-step process:
Here is an example:
For clauses that reference a time period, UC Analytics supports a number of pre-defined periods. They are as follows:
To use a time clause that references a period, you must associate the given period as a local variable that is referenced in the actual clause. The periods are part of the RelativeDate attribute and are as follows:
For example, if you want to look at messages in the last five weeks, you would add the $weeks item and establish the following time clause:
About the Where clause
The Where clause in the query definition is used to specify conditions that restrict the selected items. As with most query syntax, the Where clause follows a simple structure:
To establish a filter, you must establish a reference to the filter type:
UC Analytics supports the following comparison filter operators that must be specified as local variables:
Next, you must specify the attribute name. The naming convention for the attributes is explained in Finding a full attribute name and applies in this clause. Enter the full name of the attribute on which you want to filter.
For the value, there are different values that you can enter. The value that you need to specify depends on what is listed as the attribute type. Possible values are listed here:
Based on this simple Where clause, you would enter:
About more complex Where clauses
Though a simple Where will work, you can use more complicated Where clauses. See the following examples for more complex scenarios:
Some fields are collections of records. One example is Recipients. UC Analytics provides the ability to establish a query based on the following criteria for these multi-valued fields:
The query for the underlying recipient follows the previous example. The additional field is added above it to provide the total filter.
For example, to query on any recipient with something specified in the recipient name:
To use either of these two fields, you must define the associated local variables:
The Not operator is a common Boolean operator. UC Analytics provides support for this construct using the same style as the multi-valued attribute. The only difference is that you define a filter expression that you reference to the specified filter clause.
You must specify the Not operator:
For example, you could query on any recipient that does not have a value in the recipient name:
Much like the Not operator, the AND / OR operators are common. These operators are used in a similar manner as the Not operator, but with two filter clauses.
You must specify the additional operators:
For example, to query on any recipient that does not have a value in the recipient name:
You can achieve the AND operator by providing two consecutive Where conditions. The following statement is the same as the previous Where condition for AND:
You can use this clause in both query types.