The examples in this section all refer to a grid that contains columns from a table of employees.
The expression >50000
in
the Criteria row in the Salary column in the
grid retrieves information for employees whose salaries are less
than $50,000.
Figure 17-10: Expression criteria example using a relational operator
The SELECT statement that PocketBuilder creates is:
SELECT emp_id, dept_id, salary FROM employee WHERE salary < 50000
The expression >300
in
the Criteria row in the EmpId column and the expression <50000
in
the Criteria row in the Salary column in the
grid retrieve information for employees whose employee IDs are greater
than 300 and whose salaries are less than $50,000.
Figure 17-11: Expression criteria example using default logical operator
The SELECT statement that PocketBuilder creates is:
SELECT emp_id, dept_id, salary FROM employee WHERE emp_id >300 AND salary <50000
The expressions 100
in
the Criteria row and >300
in
the Or row for the DeptId column, together
with the expression <50000
in
the Criteria row in the Salary column, retrieve
information for employees who belong to:
Department 100 and have a salary less than $50,000
or
A department whose ID is greater than 300, regardless of their salary
Figure 17-12: Expression criteria example using two default logical operators
The SELECT statement that PocketBuilder creates is:
SELECT emp_id, dept_id, salary FROM employee WHERE (dept_id = 100 AND salary < 50000) OR dept_id > 300
The expression IN(100, 200, 500)
in
the Criteria row in the DeptId column in the
grid retrieves information for employees who are in department 100 or 200 or 500.
Figure 17-13: Expression criteria example using the IN relational operator
The SELECT statement that PocketBuilder creates is:
SELECT emp_id, dept_id, salary FROM employee WHERE dept_id IN (100, 200, 500)
This example shows the use of the word AND in
the Or criteria row. In the Criteria row, >=500
is
in the EmpId column and >=30000
is
in the Salary column. In the Or row, AND
<=1000
is in the EmpId column
and AND <=50000
is
in the Salary column. These criteria retrieve
information for employees who have employee IDs from 500 to 1000
and salaries from $30,000 to $50,000.
Figure 17-14: Expression criteria example overriding the default logical operators
The SELECT statement that PocketBuilder creates is:
SELECT emp_id, dept_id, salary FROM employee WHERE (emp_id >= 500 AND emp_id <= 1000) AND (salary >= 30000 AND salary <= 50000)
In a grid with three columns: Emp Last Name, Emp
First Name, and Salary, the expressions LIKE
C%
in the Criteria row and LIKE
G%
in the Or row in the Emp Last
Name column retrieve information for employees who have
last names that begin with C or G.
Figure 17-15: Expression criteria example using the LIKE relational operator
The SELECT statement that PocketBuilder creates is:
SELECT emp_last_name, emp_first_name, salary FROM employee WHERE emp_last_name LIKE 'C%' OR emp_last_name LIKE 'G%'
You can allow your users to specify selection criteria in a DataWindow object using these techniques during execution:
You can automatically pop up a window prompting users to specify criteria each time just before data is retrieved
For more information, see Chapter 18, “Enhancing DataWindow Objects.”
You can place the DataWindow object in query mode using the Modify function
For more information, see the Resource Guide.