4D v13.4

Query by example

Home

 
4D v13.4
Query by example

Query by example  


 

 

The Query by Example option is a convenient way to perform many queries. In this type of query, you use the current input form to enter values on which to base the search. You can only search in fields of the current table. Query by Example performs both indexed and sequential queries.

The Query by Example window shown is just an example. Your current input form is always used as the Query by Example window. You can control the appearance of the Query by Example window by changing the current input form.

You can use comparison operators in Query by Example. For example, to use the “is equal to” comparison operator, enter the value to be searched for in the appropriate field. If you need a different comparison operator, precede the value with one of the following signs:

ComparisonOperator SignExample
is not equal to##Marketing
is greater than>>30000
is greater than or equal to>=>=30000
is less than<<30000
is less than or equal to<=<=30000

You can request a “Begins with” query by placing the wildcard character (@) after the value to be searched for. 

The following figure shows the Query by Example window being used to search for all companies whose names begin with “S”.

You can create a compound query by typing values into more than one field. If you enter a compound query, the And conjunction is assumed (e.g., “Name starts with “S” and is in California”). The following Query by Example window illustrates a compound query. 

To use Query by Example:

  1. In the Design environment, choose Query > Query by Example from the Records menu.
    OR
    Choose Query by Example... from the menu associated with the “Query” button in the tool bar.
    4D displays the input form for the current table as a Query By Example window. Only the Accept and Cancel buttons are enabled.  
  2. Enter a value to search for in a field.
    For example, to find records for everyone with the last name “Smith,” you would enter “Smith” in the Last Name field.
    To use a comparison operator, precede the value by the comparison operator (see the “Comparison” table on page 1000). To do a “begins with” search, follow the value by the “@” symbol.
    Note: It is not possible to carry out a query using keywords in this editor.
  3. To perform a compound query, enter values in additional fields.
    4D uses the And conjunction if you enter values for more than one field.
  4. Click the Accept button or press the Enter key on the numeric keypad to do the query.
    To cancel the query, click the Cancel button or use the Escape or Esc key.
    The record(s) that meet the search conditions are displayed in the current output form.

 
PROPERTIES 

Product: 4D
Theme: Searching records