Adding conditions to a Visual Query

After you define the structure of a Visual Query, you can add query conditions to the items in the query structure to look for records with specific values in their properties and metadata.

About this task

This example describes the conditions that you might specify for the following query.

Imagine that you want to search for people who are called John Doe, own a car, and hold at least two accounts. The car is blue and the license plate starts with ABC. To achieve this query, the structure must take the form of a Person that is connected to a Vehicle with an Owner link. The Person must also be connected to an Account with an Account Holder link. The Account must be given a count condition.

You must then set the following query conditions:
  • On the Person query entity:
    • Given Name is exactly John.
    • Family Name is exactly Doe.
  • On the Vehicle query entity:
    • Color is exactly Blue.
    • License Plate starts with ABC.
  • On the Account query entity, the count condition must have the value greater than or equal to 2.

Procedure

  1. The Query conditions pane of a new or open query in the Visual Query window contains a list of all the items in the query structure. Click the plus icon Add condition button next to the item that you want to add the condition to.
    The Add or remove conditions window opens. Property types are listed first, followed by metadata types.
  2. Select the property or metadata type, or date and time aspect for which you want to add conditions and click OK.
  3. For each property or metadata type, select the operator and enter or select the value. For some types and operators, you can enter multiple values. To enter multiple values:
    1. Click the Edit value list button Edit value list button next to the value.
    2. Enter each value on a separate line.
    3. Optional: If you have a text file that contains the values that you want to add, you can import it. Click Import text file and browse to the file. Any file that you import must have the file type .txt and must contain row separated values.
      Note: Value fields in a condition have a maximum number of characters. If you try to import a file that contains too many characters, no text is inserted.
    Note: Searches are not case-sensitive.
  4. To add a second or subsequent condition with the same type, click the Actions button Actions button next to the type, then click Add Another.
  5. Repeat steps 1 - 4 for the other entities and links in the query structure for which you want to add conditions.
  6. After you add the conditions, click Run.
    Analyst's Notebook Premium executes the query and displays the results.
  7. After you receive results, you can refine the search terms or use filtering to reduce the result set. To filter results, select a value (or a value range) for a particular property or metadata category.

    For example, a search for people with the first name John who are linked to an address might display many results for the Person type. You might then select a property value range to filter out all results except people whose date of birth falls in the range 1959 - 1964.

    Each filter is displayed at the top of the window.
    Note: To remove a filter, delete it by clicking the cross next to the filter.
  8. Optional: You can filter the results further using text search terms. Type your text into the input field and hit enter. If the text is found in the search results, it is highlighted. Click X on the input field to clear the text, or overtype the text with a new search term.
  9. Include context automatically includes the associated links when you copy entity records from the result set to the chart. For example, if your results include people and the cars that they own, when you copy a Person record to the chart, their Vehicle records and link records are also displayed. Click the button to deselect the option.
    You can use Include context only with records returned in the result set. If you specify in your query structure that you do not want linked vehicles returned in the results, you cannot use include context to retrieve them.

What to do next

When the search results are displayed, you can copy one or more of the records that they represent to your chart.