## Search Condition dialog

This dialog appears when you click Query > Filter in the Query Editor window. It helps you to specify more criteria for the fields to be retrieved from the database. See the dialog.

The following are details about option in the dialog:

Add Condition

Adds a new condition line.

Delete

Deletes the selected condition line.

Group

Makes the selected conditions in one group. Conditions can also be added to an existing group by selecting the conditions and the group while holding the Ctrl button, and then clicking the Group button.

Ungroup

Makes the selected condition ungrouped.

Up

Moves the selected condition up to a higher level.

Down

Moves the selected condition or group down to a lower level.

Logic

Lists the logic operator.

- And
  Logic operator And which is applied to this and the next line.
- Or
  Logic operator Or which is applied to this and the next line.
- And Not
  Logic operator And Not which is applied to this and the next line.
- Or Not
  Logic operator Or Not which is applied to this and the next line.

Field

Specifies the field to be filtered. You can either type in the field manually or click to specify the field in the Expressions dialog. The following are the options in this dialog:

- Real Name tab
  Lists the tables added in the query with all their columns, also the formulas and parameters in the catalog. Double-click the required field to create the filter on it.

  The following symbols at the bottom of the Expressions dialog allow you to modify the expression according to your requirements.

  - +
    Adds numbers or fields together in the Expression menu.
  - -
    Subtracts numbers or fields together in the Expression menu.
  - *
    Multiplies numbers or fields together in the Expression menu.
  - /
    Divides numbers or fields together in the Expression menu.
  - =
    Equates fields together
  - "
    Places quotations on long character strings or name that have blanks in them. For example, you should place quotes on values such as "New York" or "Washington DC")
  - ||
    Allows you to place fields together in the same Expression menu. For example, "New York" || "Washington DC")
  - ( )
    Places your fields in parentheses
- Subquery tab
  Allows you to create a subquery by editing a query or creating a new query. For details about using sub-queries, see Using sub-queries in filters.
  - Edit Subquery
    Opens the Query Editor window to edit the query.
  - New Subquery
    Creates a new subquery here.
- Field Value tab (disabled when the Expressions dialog is opened while setting the filter field)
  Lists all column names of the related table, in which the field to be filtered is. Check the column name of the field to be filtered, click OK, then the values of the field will be displayed. Choose the required value and click Set to use it to filter the field.

Operator

Lists all the operators that can be used in the filter condition:

- =
  Equal to
- <>
  Not equal to
- >
  Greater than
- >=
  Greater than or equal to
- <
  Less than
- <=
  Less than or equal to
- [not] in
  Causes an enumerated list of values to appear in the WHERE clause predicate, used for evaluating for a true condition. The [not] in operator supports multi-value parameters as the value.
- [not] between
  Allows the system to evaluate whether or not data values are located between a range of values indicated in the predicate.
- is [not] null
  It is used in WHERE clause predicates to match null values occurring in a specified data column.
- [not] like
  Like string pattern matching operator is used to compare the first expression string value to the pattern string (the second expression). If you want to use wildcard character in the pattern string, only "_" and "%" are supported.
- sounds like
  Sound like operator uses a soundex algorithm to pattern match strings that sound alike.
- [not] exists
  It is used to test if a subselect retrieves any records.

Value

Specifies the value of how to filter the field. You can either click next to the text box to specify the value using the Expressions dialog or type the value in the text box manually.

When you input the value manually:

- Multiple values should be separated with ",". If "," or "\" is contained in the values, write it as "\," or "\\".
- For String type values
  Quote the values with single quotes.

  Example1: Customers_Country='USA'.

  Example2: Customers_Country in 'Australia','Germany','Mexico'

  The quote marks can be typed by yourself or be added by JReport Designer automatically. To have the quote marks automatically added by JReport Designer, follow the steps below:

  1. Click the Options button on the Catalog Browser toolbar.
  2. In the Options dialog, switch to the Query Editor category and check Automatically add quotation marks on input values.
  3. Click OK to save the settings.
- For Date type values
  Make sure the format of the value you enter is consistent with that of your database. Filters are done in the RDBMS side and some RDBMS have special requirements for the date format, and you need to make sure the date formats specified in the Data Format tab of the Get JDBC Connection Information dialog are supported by your database.

  Note: In an Oracle database, if you want to use a Date or DateTime type parameter or a specific date or time to filter the fields of a query, you need to use the to_date() or to_timestamp() function in the filter condition, for example:

SQL Statement

Displays the SQL statement of the filter condition.

OK

Applies all changes and closes the dialog.

Cancel

Closes the dialog, leaving any changes unsaved.

Help

Displays the help document about this feature.

###### Related topics:

- Filtering the fields of a query