## Query Editor window

This window appears when you right-click a query in the Catalog Browser and then select Edit Query from the shortcut menu. It helps you to edit a query according to your requirements. See the window.

The following are details about options in the window:

Query Menu

- Apply
  Accepts the changes on the query.
- Save As
  Saves the query with the name you specify.
- Add Table
  Opens the Add table dialog to add tables from the current catalog to the query.
- Delete Table
  Deletes the selected table.
- Union
  Creates and modifies a union for the query.
- Filter
  Opens the Search Condition dialog to specify more criteria to limit the amount of data.
- Select Distinct
  When selected, in the SQL statement, the SELECT DISTINCT command will be used instead of SELECT.
- Ignore Predicate If Parameter Value Is Null
  If the query uses a parameter, and the parameter value is null at runtime, then this condition will be removed from the query's criterion.

  For string type parameters, when the value is left blank, if Ignore Predicate If Param Is Null is set to true, the value of this parameter will be considered as NULL, and this predicate will not appear in the WHERE clause; if false, it will be treated as an empty string(¡®¡¯).

- Customized SQL Mode
  Specifies whether to use the customized SQL mode, in which JReport will disable all the functions in the Query Editor and you can only edit the query by modifying the SQL statement in the SQL window.
- Arrange Tables
  Organizes the tables in the query.
- Show Mapping Names
  Specifies to show the full name of the column in the tables in the criteria panel of the Query Editor.
- Show Table Names
  Specifies to show which table each column belongs to in the criteria panel of the Query Editor.
- Show Paths
  Specifies to show information of the pre-join paths among tables in the query, when the pre-join feature is enabled.
- Join Columns
  Specifies to join the highlighted columns in tables together.
- Auto Join
  Specifies to join tables together based upon the default criteria set in the Options dialog (File > Options > Query Editor > Auto Join). You can also reset the criteria to join tables in the query by checking/unchecking the items on the Auto Join submenu.
  - Foreign Keys
    Specifies to automatically join tables in the query through a reference from Table A to a primary key in Table B. For example, an order form in Table A shows information on purchases that are made by a customer. It can also show this customer's ID #. The customer ID # refers to a record in Table B which lists a specific address, phone number, name, etc for the customer. The customer ID # in Table A is a foreign key because it links the customer's ordering information in Table A to the customer's information in Table B.
  - Primary Key with Same Names
    Specifies to automatically join tables in the query through a field or a combination of fields that uniquely and specifically identifies a record. For example, your credit card number is a primary key because it specifically links to your birthday, credit history, address, etc.
  - Same Column Names
    Specifies to automatically join tables in the query through a link between two columns of the same name in two different tables.
- Current Query Options
  Opens the Query Option dialog to change Auto Join and showing options.

Column menu

- Create Computed Column
  Opens the Create Computed Column dialog to create functions used for a particular query. It helps you to quickly and easily create columns with the functions available instead of writing a formula.
- Add Formula Field
  Opens the Add Formula Field dialog to add formulas to the query.
- Delete Column
  Deletes the selected column in the Criteria menu. To undelete, find the field in the table you deleted and place a check mark beside it.

View menu

- Edit SQL
  Shows the SQL statement of the query.
- Preview
  Opens the Preview Option dialog to preview the records.

Help menu

- Query Editor Help
  Displays this help document.

Toolbar

The following are commands on the toolbar:

- Add Table
  Adds some extra tables to the query.
- Delete Table
  Removes some unwanted tables from the query.
- Create Computed Column
  The create functions are used for a particular query. It helps you to quickly and easily create columns with the functions available instead of writing a formula.
- Add Formula Field
  Adds formulas to the query.
- Delete Column
  Removes some unwanted columns from a table.
- Arrange
  Organizes joined or auto joined tables.
- Preview
  Opens the Preview Option dialog to preview the records.

Criteria panel

Lists all columns added to the query. You can specifically define criteria for the columns in this panel.

SQL

Shows the SQL statement of the query.

Show Paths

Shows information of the pre-join paths among tables in the query, when the pre-join feature is enabled.

OK

Accepts all changes and closes the window.

Cancel

Does not retain any changes and closes the window.

Apply

Accepts all changes in the window.

Help

Displays this help document.

###### Related topics:

- Creating a query
- Editing a query
- Previewing a query
- Creating and modifying a union query