Adding a Query Prompt to the Form

A query prompt enables users to enter criteria to filter database records at print-time. After it is defined in the Filter view of the Database Setup dialog, the query prompt is available as a data source that can be connected to a control on the data entry form by using the control's Linked Data Source property page. Linking a query prompt to a control on your form enables users to select filter criteria from actual values that exist in the database for the field on which you are filtering the records. This can increase the accuracy of the filter, ensuring the correct records are available for printing or for driving further form functionality.

Examples

The examples in this section are meant to help you become familiar with the basic steps for using query prompts on your data entry form. To complete the examples, you will first need to connect to a simple database, create three text objects in your template, and create a query prompt for the connected database.

ClosedSetting Up Your Document for Use with the Examples

The following examples require that you connect to a database with a table that contains products, where each product is one of three specific types, such as that shown below.

ID
0543166
17890
1203768
1029384
98563
467233

Product
Oranges
Flower Pot
Apples
Bananas
Glass Globe
Shovel

Type
Perishable
Breakable
Perishable
Perishable
Breakable
Tool

The examples also assume that you have done the following:

ClosedLink objects on your template to database fields

  1. From the Create menu of the Template Design view, click Text, and then select Single Line. Alternatively, click the icon on the object toolbar, and then select Single Line.

  2. Click the template to place the object at the cursor location.

  3. On the Data Sources pane of the Toolbox, expand the Database Fields node.

  4. Click on and drag the ID field to the text object, linking the object to the data source.

  5. Repeat steps 1 and 2 to create a new text object.

  6. From the expanded Database Fields node on the Data Source pane, click on and drag the Product field to the new text object, linking the object to the data source.

  7. Repeat steps 1 and 2 to create a new text object.

  8. From the expanded Database Fields node on the Data Source pane, click on and drag the Type field to the new text object, linking the object to the data source.

ClosedCreate a query prompt for the Type field

  1. From the File menu, select Database Connection Setup to open the Database Setup dialog. Alternatively, click the icon on the main toolbar. If you have not previously connected to a database, this step will launch the Database Setup Wizard. Complete the wizard to display the Database Setup dialog.

  2. From the Navigation Pane of the Database Setup dialog, select Filter to open the Filter property page.

  3. Click to create a new filter condition.

  4. Click the [Data Source] and select the Type database field from the list.

  5. Click the [Operator] to select Equals.

  6. Click <enter a value> and select New Query Prompt to open the Query Prompts dialog.

  7. Name the query prompt "Type". Specifying the additional query prompt options is necessary only if you do not plan to associate the query prompt with a data entry control. If you use the query prompt in conjunction with a control, the options are set by using the control's property pages.

  8. Click OK to close the Query Prompts dialog.

  9. Click Apply Filter to apply your filter and see the results. The query prompt will ask for input.

  10. Click OK to close the Database Setup dialog.

If you stop here, BarTender will display a dialog at the beginning of your print job asking you to filter (or "query") the records you want to print. By entering a type, such as "Breakable," BarTender will print only those records that match (the products "Flower Pot" and "Glass Globe").

The following examples demonstrate how to integrate query prompts with data entry controls on a form. Once you do connect a control to a query prompt, the prompt appears on the form rather than in its own unique dialog.

ClosedExample 1: Connecting a Query Prompt to a Radio Button List Control

  1. Open the form where you want to place the query prompt.

  2. From the Create menu, click Data Entry Control, and then select Radio Button List. Alternatively, click the icon on the object toolbar and select Radio Button List.

  3. Click the form to place the control at the cursor location.

  4. Double-click the control to open the Radio Button List Properties dialog. Alternatively, select Properties from the control's context menu.

  5. From the Navigation Pane, select Linked Data Source to open the Linked Data Source property page.

  6. From the list of data sources, expand the Query Prompts node, and then select the Type query prompt.

  7. From the Navigation Pane, select List Items to open the List Items property page.

  8. If not already specified, select Query Prompt Values for the Source. Note that the values shown for the Display Text and Item Value properties reflect the values of the database Type field.

  9. Configure other properties of the control by using the provided property pages.

  10. Click Close to close the Radio Button List Properties dialog. Note that the radio button list now displays a button for each value of the Type database field.

  11. Click on the main toolbar to preview your data entry form.

You can modify how the different records appear on the form by changing the Display Text. This will not affect what is actually printed on your items.

When you make a selection from the radio button list on the form, BarTender will print only those records that have the type that matches your selection.

ClosedExample 2: Connecting a Query Prompt to a Check Box Control

Ideally, for a check box control, the database table would contain only two unique values for the Type field. For this example, assume that there are only two values, "Perishable" and "Tool". When the check box is enabled, the "Perishable" records will print on the item. When it is not checked, then the "Tool" records will print.

  1. Open the form where you want to place the query prompt.

  2. From the Create menu, click Data Entry Control, and then select Check Box. Alternatively, click the icon on the object toolbar, and then select Check Box.

  3. Click the form to place the control at the cursor location.

  4. Double-click the control to open the Check Box Properties dialog. Alternatively, select Properties from the control's context menu.

  5. From the Navigation Pane, select Linked Data Source to open the Linked Data Source property page.

  6. From the list of data sources, expand the Query Prompts node, and then select the Type query prompt.

  7. From the Navigation Pane, select Check Box to open the Check Box property page.

  8. For Display Text, type Perishable.

  9. Ensure that Use the Display Text for the Checked Value is checked.

  10. For Unchecked Value, type Tool.

  11. Click Close to close the Check Box Properties dialog.

  12. Click on the main toolbar to preview your data entry form.

ClosedExample 3: Connecting a Query Prompt to a Text Input Box Control

  1. Open the form where you want to place the query prompt.

  2. From the Create menu, click Data Entry Control, and then select Text Input Box. Alternatively, click the icon on the object toolbar and select Text Input Box.

  3. Click the form to place the control at the cursor location.

  4. Double-click the control to open the Text Input Box Properties dialog. Alternatively, select Properties from the control's context menu.

  5. From the Navigation Pane, select Linked Data Source to open the Linked Data Source property page.

  6. From the list of data sources, expand the Query Prompts node, and then select the Type query prompt.

  7. From the Navigation Pane, select Autocomplete to open the Autocomplete property page.

  8. Check Enable autocomplete.

  9. From the Source dropdown list, select Query Prompt Values. Note that the values shown for the Autocomplete Suggestions reflect the values in the database field "Type".

  10. Click Close to close the Control Properties dialog.

  11. Click on the main toolbar to preview your data entry form.

Related Topics