How You Use the Condition Builder

You use the Condition Builder to create a “Condition”. A Condition is a set of logical Condition Statements that will be evaluated together as one expression to select records. For example, in the case of the Toolbar Locate control, the Condition Statements form the FOR expression in the Visual FoxPro LOCATE command. In the case of the Toolbar Filter control, the Condition Statements form the SET FILTER TO expression.

The Condition Statements that you create for a Condition are listed in the Modify Condition box on the right-side of the Condition Builder. A Condition consists of one or multiple Condition Statements. When a Condition is composed of more than one Condition Statement, the Condition Statements may be connected by an implicit logical AND operator or by an explicit logical OR operator. Condition Statements listed next to each other are assumed to be connected by an implicit AND operator. To connect Condition Statements by an OR operator, you must explicitly insert the OR operator by clicking the Add “Or” button below the Modify Condition box. The AND operator takes precedence over the OR operator, just as in any Visual FoxPro expression.

As an example, let’s say you needed to apply a filter to the Employee Basic Data form in the VPME Sample Application. Let’s say your filter needs to select employees located in Florida or California who were born before 1946. Here’s what the Condition Statements would look like in the Modify Condition box on the Condition Builder:

In plain English, these Condition Statements say “select an employee’s record (1) if the employee’s state is Florida and the employee was born before 1946 or (2) if the employee’s state is California and the employee was born before 1946. Notice that the AND operator is implied between Condition Statements that are not separated by the OR operator.

Now, let’s explore the ins and outs of building Conditions. The next section describes how to use the Condition Builder in detail.

Ø To use the Condition Builder

1.   When you select the Toolbar Locate, Filter and Group Delete controls and the Report Setup dialog’s For and While options, VPM Enterprise displays the ProMatrix Condition Builder. If you have not previously built and saved a condition, the Condition Builder looks like this:

   The Condition Builder is divided into two columns. The left column lists the previously created and saved condtions in the condition library. The right column is used to build condition statements for a Condition.

2.   Starting and Naming a New Condition: To build a new condition, click the New condition button in the left-side Conditions column. If you want to save your new condition in the Conditions Library, enter a unique name for the condition in the Name box. If you like, enter a brief description of the purpose of the condition in the Comments box.

3.   Starting a New Condition Statement: Click the New button in the right-side Modify Condition column. You can now access the Cursor, Field, Operator and Value boxes and the Modify Condition buttons to build a Condition Statement. The Condition Builder should now look something like this:

   Notice that there’s already a Condition Statement in the Modify Condition box. It’s based on the first field in the Field list and the default Operator, which is “equal to”. When you build your first Condition Statements, it will replace the Condition Statements you see now.

4.   Select Cursor and Field: The next step in building a Condition Statement is to select the field for the statement. First, in the Cursor combo box, select the table, view or CursorAdapter that contains the field you want. Then, select the field in the Field combo box. The field you select will appear in the Condition Statement highlighted in the Modify Condition box.

5.   Select Operator: Select an operator in the Operator combo box. The operator defines how the field will be used with the value you enter into the Value box. The operator you select will appear in the Condition Statement highlighted in the Modify Condition box. The following operators are available to you:



not equal to


less than


greater than


less than or equal to


greater than or equal to


equal to


exactly equal to

For Condition Statement to be true, the value in the Field and the Value entry must not only be equal in value but must also be equal in length.


Enter comma delimited list of values in Value box. For Condition Statement to be true, Field must contain one of the values in the list.


Enter character string in Value box. Condition Statement is true if character string is contained anywhere within the Field.

is true (checked)

Only enabled for logical, or check box, fields. Means logical field contains "T", or check box is checked.

is false (unchecked)

Only enabled for logical, or check box, fields. Means logical field contains "F", or check box is unchecked.

6.   Enter a Value: Enter the value in the Value box that will be compared to the Field you selected. Do not enter delimiters such as quotes or braces. The Condition Builder will add quotes and braces as needed. Enter dates in the Date format specified on the Environment dialog accessed from the application’s Admin menu. By default a date should be entered in the mm/dd/yy format. The entry you make will appear in the Condition Statement highlighted in the Modify Condition box.

7.   Match Case: If you check the Match Case check box, the field and value entries are compared not only on the entry values but also on the case of the entries. If the March Case check box is not checked, case is not taken into account in the comparison.

8.   Build Additional Condition Statements: If the Condition you are building requires additional Condition Statements, repeat steps 3 through 7 above. If the next Condition Statement you create should be separated by the OR operator from the Condition Statement you just completed, click the Add “OR” button before clicking the New button to start the next Condition Statement.

9.   Adjust Condition Statements as Needed: If you need to change the order of the Condition Statements, select the Condition Statements you want to move and click the Move Up or Move Down button. If you need to add an OR operator, select the Condition Statement that the OR should follow and click the Add “OR” button. If you need to remove a Condition Statement, select the statement and click the Remove button.

10. Apply and Save Your Condition: After you complete your set of Condition Statements, the Condition Builder should look something like this:

   Click the OK button to apply your Condition.

·       You will be prompted to save your Condition. Click Yes to save the Condition.

·       Global Conditions: If you have the permission to create global conditions, you will be asked: “Do you want to save this condition as a global condition?” Click Yes to save the condition as a global condition.

·       After you save the Condition, it will appear in the Conditions list the next time you access the Condition Builder for the form or report.

·       When the Condition Builder closes, your Condition will be used to select records for whichever Toolbar control or report option you selected to activate the Condition Builder.

11. Using Conditions from the Conditions Library: When you access the Condition Builder for a form or report for which you have previously built and saved Conditions, you can apply a saved Condition by simply selecting it in the Conditions list and clicking OK. You can also select the Condition and modify it before you apply it.

Tip: The table, view and CursorAdapter names shown in the Condition Builder Cursor list come from the Description field entries you make for tables, views and CursorAdapters on the Edit page in the Data Builder. The field names shown in the Condition Builder Field list come from the field Description (Long) property entries in the Data Builder. Accordingly, be sure that your Table/View/CursorAdapter Description field entries and field Description (Long) entries are understandable to users of your application.



ProMatrix Condition Field List Builder