Using retrieval arguments

If you want a report, form, or pipeline to prompt for criteria to determine which rows to retrieve when you preview the report, run the form, or execute the pipeline, you can use retrieval arguments in the SQL SELECT statement. If you define the data source without defining retrieval arguments and decide later that you need arguments, you can return to the Select painter to define the arguments.

NoteAnother way to prompt for retrieval criteria You can select View>Column Specifications from the menu bar. In the Column Specification view, a column of check boxes next to the columns in the data source lets you identify the columns to be prompted for. This, like the Retrieval Arguments prompt, calls the Retrieve method.

See Chapter 6, “Enhancing Reports,” and Chapter 20, “Enhancing Forms.”

For example, suppose you are creating a report that provides information about any employee. When you are defining the report in the Report painter, you pass the employee ID as an argument (placeholder). When you run the report, you are prompted for the employee ID, you supply the ID number, and the report displays information about that employee.

StepsTo define retrieval arguments:

  1. Make sure you are in the Select painter (from the Report painter or the Form painter, select Design>Data Source from the menu bar).

  2. In the SQL Select painter, select Design>Retrieval Arguments from the menu bar.

  3. Enter a name and datatype for each argument.

    The first character must be alphabetic (a–z); subsequent characters can be alphanumeric (a–z, 1–9), an underscore ( _ ), or a dollar sign ($).

  4. Click the Add button to define additional arguments as needed, and click OK when done.

Specifying an array as a retrieval argument

You can specify an array of values as your retrieval argument. For example, suppose you want a report that shows employee names and IDs for a few departments and prompts you to enter the IDs when you preview the report.

In the Specify Retrieval Arguments dialog box, choose the type of array from the Type drop-down list. For the case of department IDs, the array is a number array.