Query Genie

Description

The Query Genie lets you create powerful search and sort operations by navigating through easy-to-understand dialog boxes. The Query Genie is perhaps the easiest way for an inexperienced user to define complex searches of their database. It's also great for ad-hoc queries while viewing records in a form or browse.

images/UG_Query_Genie.gif

You can use the Query Genie to create one-time searches or run saved searches. In addition, the Query Genie lets you perform additive queries. For example, you run a query and are viewing the returned records, and you decide to run another query using the Query Genie. A pop-up menu appears letting you specify whether Alpha Anywhere searches in all available records, or just within the current selection of records.

The Query Genie may not display correctly if you make your default font point size too large.

Procedure

You can access the Query Genie from either a form or browse or from the Query > Query by Genie action script.

  1. Select Query > Query Genie or click the 'lamp' icon on the toolbar.

  2. Select a field from the list at the left side of the screen.

  3. Select an operator from the list in the middle of the screen.

  4. Enter or select appropriate values in the fields at the right side of the screen.

  5. Optionally click Add Condition.

  6. Select one of the two radio buttons to determine whether both conditions must be true ( AND this condition ) or either may be true ( OR this condition ).

  7. If you added a condition in step 5, repeat steps 2 through 4, otherwise continue with step 8.

  8. Optionally check the Exclude records that satisfy this condition check box to invert the logic of the condition.

  9. Click the Order By tab.

  10. Optionally, select a field from the Sort by list to be the basis of the primary sort.

  11. Optionally, click A...Z to sort in descending order.

  12. Optionally, select a field from the first then, sort by list to be the basis of the secondary sort.

  13. Optionally, click A...Z to sort in descending order.

  14. Optionally, select a field from the second then, sort by list to be the basis of the tertiary sort.

  15. Optionally, click A...Z to sort in descending order.

  16. Display the Query Options tab.

  17. Optionally, check the Exclude records that satisfy search criteria to invert the logic of the query.

  18. Optionally, check Unique records only to eliminate duplicate records.

  19. Optionally, limit the records you retrieve by using a function in the Sub-select Options list.

  20. If required, enter the value of N.

  21. Click Run Query to filter and sort the records visible in your layout.

  22. Click Close to exit from the Query Genie.

  23. Click to roll up the Query Genie.

    images/Rollup_button.gif
  24. Click to display the Filter/Order Expressions dialog box, which show Xbasic filter and order expressions you created in the Query Genie. This is an excellent way to learn or copy the syntax for creating filter and order expressions.

    images/Preview_Button.gif
  25. Click to switch from Genie Mode to Expression Mode. If you save the filter as an expression, you can no longer edit it using the Query Genie. Advanced users can use Expression Mode to type in additional filter and order expressions.

  26. Click to save the query for later re-use.

    images/Save_button.gif
  27. Click to save the query with a new name.

    images/Save_As_button.gif
  28. Click to load a previously saved query.

    images/Folder_button.gif
  29. Click to load create a new query.

    images/New_Query_button.gif

Eliminating Marked Records from a Selection with a Filter

Assuming that you have a browse view of your records.

  1. Use a query to select records.

  2. For each record you want to exclude from the selection:

    • 1. Select its row.

    • 2. Select Records > Mark (or CTRL M).

  3. Select Query > Special Queries... .

  4. Choose "Marked/Un-Marked records" in the list.

  5. Select the Un-Marked Records radio button.

  6. Check Search only in current selection of records.

  7. Click OK.

    images/UM_Exclude_Marked_Records.gif

Eliminating Marked Records from a Selection with Quick Filter (Exclude)

Assuming that you have a browse view of your records.

  1. Use a query to select records.

  2. For each record you want to exclude from the selection:

    • 1. Select its row.

    • 2. Right click on the browse and select Quick Filter (Exclude).

      images/UM_Quick_Filter_Exclude.gif

See Also