Advanced Filter Options


MarketWide's Filter dialog allows you to create filters at any level of complexity. The next few sections discuss some advanced options for refining filters. Click here for more basic filter information.. 

Topics:

Grouping Statements

 A group of statements is a set of consecutive statements connected by the 'AND' operator. In the Filter dialog, groups of statements have a solid title bar above them and a gray box around them. Groups of statements can be inside other groups.

If you are familiar with SQL, groups are sets of statements with parentheses around them.

There are two ways to group sets of statements to create filters:

Change a statement's AND operator to OR 

    • If you change a statement's AND operator to OR, the filter automatically puts that statement in a new group separated by OR.

Highlight statements and use the Group Items function.

    • If you highlight consecutive statements and click the Group Items toolbar button or choose Edit > Group from the menu, the filter places the selected statements in their own group separated by OR.

Changing a Statement's AND/OR Operator

When you add new statements to a filter the default relationship between them is AND, however, you can change that relationship to OR with a simple double click. If you change a statement's AND operator to OR, the filter automatically puts that statement into a new group separated from the other statements by OR.

To Change AND to OR

  1. In a statement in the filter, double click the AND operator to change it to OR.
  2. When you switch AND to OR, the filter automatically creates a new group.

Caution

You can change an 'OR' operator between groups back to an 'AND' operator using this method, but the groups will not automatically merge back together. If you wish to move statements back into the original group, see "Moving Statements."

Grouping Sets of Highlighted Statements

In addition to changing the AND operator to OR, you can group selected statements using the Group Items toolbar button or the Edit > Group menu option.

If you highlight consecutive statements and use the Group Items feature, the filter places the selected statements in their own group separated from the other statements by OR, as shown in the following example.

To Group Selected Statements

  1. Click the handle or the portion just in front of a statement to select it.
  2. Hold down the <Ctrl> key and click the handle on other consecutive statements to highlight all the statements you want to group.
  3. Choose Edit > Group from the filter's menu or click on the Group Items toolbar button.
  4. The filter automatically creates a new group containing the highlighted statements.

Moving Statements

You can move statements in a filter by simply dragging and dropping the statement to the new position you would like to move it to, like Windows Explorer.

To Move Statements

  1. Move the cursor over the handle in front of a statement until the arrow pointer changes to a hand.
  2. Click and hold the left mouse button on the handle on the left of the statement.
  3. Drag the statement to the new location. Arrows appear to show where the statement will be dropped and whether the statement will have an AND or OR relation to the statement above it.
  4. Let go of the mouse button to drop the statement in the new location.

Creating Subqueries

As the word implies, a subquery is a query within a query. For example, suppose you want to view all orders for customers that live in Pennsylvania, but your ORDERS_TABLE does not tell you in which states customers live. In other words, you want to view orders from the ORDERS_TABLE for a list of customer numbers satisfying certain conditions in the ADDRESS_TABLE. In SQL code, the query-subquery relationship looks like this:

Select * from Orders_Table where Customer_Number in (Select Customer_Number from Address_Table where State = 'PA')

The underlined section is the subquery, which pulls a list of customer numbers from the ADDRESS_TABLE to use as the value list for the main query against the ORDERS_TABLE.

In the filter dialog, you can use a subquery to specify values by choosing the Subquery popup menu option when you right-click the value area of a statement. The popup menu with the Subquery option only appears when you use the IN or NOT IN condition in your statement.

When you select the Subquery option, QueryBuilder appears and allows you to build the subquery using its point-and-click interface. A statement with a subquery shows SQL (…).

To Create a Subquery

  1. Add a statement to the filter. 
  2. Use IN or NOT IN as the condition for your statement. 
  3. Right-click the value area of the statement to bring up a popup menu.
  4. Click Subquery to open QueryBuilder.
  5. Use QueryBuilder to construct the subquery.
  6. Click OK to close QueryBuilder and confirm your changes

Custom SQL Statements

If you are familiar with SQL syntax and want to enter custom SQL text in your filters, you can use the SQL Text option in the left pane of the filter under the folder titled Special Objects. The SQL Text option allows you to add a statement to your filter in the right pane with your own SQL commands within it.

When you drag the SQL Text option to the right pane, a new statement appears asking you to Type SQL text here. You can enter any SQL code you like.

Adding Custom SQL Text

  1. Click on the SQL Text option in the filter's left pane and drag it to the desired position in the right pane.
  2. In the new statement, highlight Type SQL text here... and begin typing your SQL commands.
  3. When finished, click anywhere outside the statement to commit your changes.

Modifying Custom SQL Text

  1. Click on your custom SQL statement.
  2. Type in your changes.
  3. When finished, click anywhere outside the statement to commit your changes.

The Filter Menu and Toolbar

The Filter toolbar provides quick access to commonly used commands. Click an icon once to carry out the action.

Icon

Description

Menu Equivalent

Opens a dialog box to retrieve a MarketWide report.

File > Open

Saves the open filter.

File > Save

Allows you to select how and where the filter is saved.

File > Save As

Opens the Preview dialog to format how the filter is printed.

File > Print

Allows you to undo the last action.
 

Edit > Undo
 

Allows you to redo the last action.
 

Edit > Redo
 

Copies the entire filter to the Windows Clipboard.

Edit > Copy

Pastes the contents of the Windows Clipboard into your filter.

Edit > Paste

Deletes the highlighted statement or group.
 

Edit > Delete
 

Groups highlighted statements and separates the group from other statements using an AND operator.
 

Edit > Group
 

Moves the currently selected group to the left.

Edit > Move Left


 

Moves the currently selected group to the right.
 

Edit > Move Right
 

--

Highlights a specific group in the filter.

View > Group Frame

--

Opens SQL Text Dialog box to enter in SQL commands.

View > SQL Text

--

Cleans up areas of the filter that are not being used.

Tools > Clean-Filter

--

Shows the results of the currently selected table field in the QueryBuilder module.

Tools > Frequency Distribution

--

Opens Help files about the Filter dialog.

Help > Filter Help