Registered Queries

This topic describes the execution of a registered query.

The following diagram shows how to create and use a registered query.

The client application does the following:

  1. It instantiates a query object, which defines the filter expression and the list of attributes that are to be returned.
  2. It uses isQueryRegistered to determine if the query is already registered, and if not, it calls the registerQuery operation to register the query, using the defined query object. Event Collector parses and stores the query for later use.
  3. It performs an executeRegisteredQuery function each time the query is needed. QueryOptions can be used to dynamically alter the query parameters without having to alter and re-register the query itself. (See Using Late-Bound Parameter Literals.) The function returns the list of events matching the filter criteria. The requested attributes and values are returned for each event.
    Note: The QueryIdentifier can identify the query using either its descriptive name (tag) or its GUID. Performance is improved when using GUID, so when calling a query many times it is recommended to look up the query’s GUID using the lookupQueryByTag function.
  4. It performs an unregisterQuery function to remove the query when it is no longer needed. This removes the query from the Event Collector database table.