Defining a query

A query is constructed in two parts, a structure that defines the record types of interest, and conditions that define exactly which records are retrieved. When you have defined a query, it can be saved for future use.


To define a simple query, you need to draw a structure diagram containing the entity and link types that you want to query:
  1. Select one of the entity types (or 'any type') in the Query palette and drag it into the empty pane on the right. The entity type will be shown with an output symbol next to it. This means that records for this entity type will be included in the results of the query.
    If the symbol is not displayed next to the entity type, you need to add it because at least one entity or link type must be set as output:
    1. Select the entity. The entity label is highlighted in blue.
    2. Click Output Selected Item to add it.
  2. Select another entity type and drag it in to the pane on the right.
    Note: Once you add an additional entity type to the query, you must link them. However, the link type drop-down list is only available if there is a link type defined for the two entity types in the drawing pane.
  3. Add a link between the two entities:
    1. Select a link type from the drop-down list.
    2. Click Add Link.
    3. Hold down the left mouse button and drag a link from one of the entities to the other entity.
    4. If the link has a direction, right-click on it and from the shortcut menu, select Add Arrow. To reverse the direction of the arrow or remove it altogether, right-click on the link and select the appropriate command from the shortcut menu. When you run the query, iBase will only search for links with this link direction.
  4. If required edit the labels on the entity and links. This serves a reminder of the purpose of the query, if you intend to save the query. To edit a label, click the label to highlight it and then click again. The label changes into a text box.
    Edit the label and then press the Enter key to apply your changes.
  5. Click Results to run the query and display the results. For each item in the query, iBase will search all the records in the database. You can limit the search to a smaller number of records.
  6. In the Results list, select each record to examine the values in its fields.
    Note: If necessary, you can refine the query by specifying query conditions.
  7. Click Back and then Save to save your query so that you can run it again later.