Ordering and Selecting Records

Description

You can specify the order and selection criteria for the records that appear in your report either:

  • in the report layout

  • by interactively performing a query on your data

  • just before the report is printed

For example, you have a report that prints a list of customers. If you want the report to always print only customers from New York, sorted by Lastname, you can specify those criteria directly in the report layout. Alternatively, you might have a form that you use to view your customer records. Using the Query Genie, or Query by Form, for example, you might perform different queries to see different views of your data. After performing a particular query that selects certain records, you might want to print out just those records. Finally, you might want to decide which customers to print, and in what order, each time the report is printed. You can omit specifying selection and sort criteria in the report, and specify instead that you should be prompted at print time. The order and selection criteria options can be set in the Detail Properties dialog box.

  1. While the Report Editor is visible, select Report > Properties > Detail Properties....

  2. When the Detail Properties dialog box appears, display the Records tab.

    •  Setting Selection and Order Criteria

      Alpha Anywhere lets you store filter and order criteria with the report. Do this by entering expressions in the Order expression and Filter expression fields. If your report contains one or more grouping levels, the primary order of the records is determined by their group break expressions, but the order expression that you enter still applies to the detail records.

  3. Optionally, enter an expression that returns a logical value to select records from the underlying table or set in the Filter expression field. You may click the 'xy' button to open the Expression Builder to help you construct the expression. Alpha Anywhere will select the records for which the expression evaluates to TRUE. For more information on filter expressions, refer to Ordering and Selecting Records.

  4. Optionally, click Marked (records) or Unmarked (records) to add additional selection criteria. For example, if you select the Marked radio button, and you enter a filter of "State = 'MA'", then Alpha Anywhere will select only the marked records in MA.

  5. Optionally, enter an expression that returns a character value to order the records you selected from the underlying table or set in the Order expression field. You may click the 'xy' button to open the Expression Builder to help you construct the expression. The order expression generally consists of one or more fields concatenated with the plus sign (+). For example, if you want to sort customer-records by their names, you might use an order expression of Lastname+Firstname .

    •  Additional Selection and Ordering Criteria

      In addition to the selection and ordering criteria that you store with the report, there are some additional options. The Additional Record Order and Filter criteria group lets you specify the following options:

  6. Optionally, click None. There are no additional criteria. The report will be based on the filter and order expressions that you have specified.

  7. Optionally, click Base Report on current selection of records. The report will be based on the current selection of records. This option is typically used when you have a form with a button on the form to print a report. While using the form to view records, you might have run a query to select a particular subset of records. Now, you would like to print out this subset of records using a report. By selecting this option, (and leaving the Filter expression and Order expression boxes blank), the report will use the current selection of records.

    If you have entered an expression in the Filter expression field, then the report will be based on the criteria you entered in the Filter expression field in addition to the filter for the current selection of records.
  8. Optionally, click Prompt for criteria at print time : Alpha Anywhere will display a genie at print time, letting you select a primary index, starting and ending key value, and other options. The criteria that you specify at print time are in addition to any criteria that you may have entered in the Filter expression and Order expression boxes.

  9.  Base the Report on a Query

    Optionally, click Use filter/order from Query... .

  10. Select a query from the resulting Use a Query dialog and click OK. This will reset the values of the Order expression and Filter expression fields.

  11. Click OK to apply the new filter and order criteria to the report.

See Also