

Aware IM uses queries to search for information in the database. You can use queries in various parts of your application, for example:
Aware IM offers several ways of specifying queries.
Search using a data form has been a popular option with many database users for years. Aware IM fully supports form-based queries where you can type values in fields on form to find records in the database with matching values. You can use expressions when entering you search criteria, such as 'less than', 'more than', 'between' etc. Also, you can search using fields of related records on a form. For example, you can find all orders containing a certain product by typing the product name in the line item record on the order form.
Query composer provides an easy way to define a query using a point-and-click interface. Simply select the business object to search for (e.g. Client), an attribute (e.g. Name), an operator (e.g. CONTAINS) and type a value (e.g. Smith). You can have multiple conditions in the same query connected with AND or OR.
Queries can also be defined using the business rule language - by far the most flexible and powerful, although still easy, way to create a query in Aware IM. You can create elaborate search requests without much database knowledge. For example, if you want to get a list of all customers who ordered products from a particular manufacturer, you could do it like this:
FIND Client WHERE EXISTS LineItem WHERE (LineItem.Order IN Client.Orders AND LineItem.Product.Manufacturer.Name = 'Sony')
Note how this compact and easy-to-read query combines the use of objects Client, Order, Line Item, Product and Manufacturer. Behind the scenes Aware IM automatically constructs a rather complex SQL query with multiple table joins and sub-queries.
With this type of queries you can:
FIND Client WHERE SUM Order.Amount WHERE (Order IN Client.Orders AND Order.Status = 'Shipped') > 10000
FIND Client WHERE Client.Status='Active' ORDER BY Client.DateOfBirth TAKE BEST 1
FIND Client WHERE AGE(Client.DateOfBirth) > 50
Often you may want to let the user enter the desired search parameters. For example, it would be good if the user could enter the name of the manufacturer in the above query. In Aware IM you can easily accommodate user-specified search criteria by selecting the 'ask at run-time' value in a query condition. Before executing the query Aware IM will automatically generate and display a form for the users to enter their search criteria. You do not need to add any special attributes or create additional forms.
Aware IM lets you search for records of different types, as long as they are members of a business object group. For example, you may have objects Outgoing Email, Incoming Email and Outgoing Letter representing different types of communication with clients, as members of group Communication. Then you could search for all client contacts, regardless of their type, made during the day:
FIND Communication WHERE Communication.ContactDate = CURRENT_DATE
All found records will be displayed in the same list, but when you click on a record Aware IM will show you the record details using a data form specific to the object. Behind the scenes Aware IM automatically constructs an SQL query that includes table joins to search across multiple tables.
When looking at the list of records found by a search, you can refine the results by making another search to further narrow down the record list, or extend it to include more records. Similarly, you can filter and sort the list of related records on a data form. This is a built-in Aware IM functionality, you do not need to create any additional queries or forms.
In addition to queries you define when creating your application, you can also allow the users of your application to create their own personal queries to search for data in a specific way. This is especially useful for more sophisticated applications when people may need to make many different search requests. Aware IM keeps personal queries separately for each user and makes them available to the user when he or she logs into the application.
If you are an SQL expert you can specify certain queries in SQL. Since Aware IM works with SQL-compliant databases, you can construct any statements allowed in the standard SQL. In practice, though, you will probably find that the business rule language is sufficient to create almost any query you may need.