A Query is an instruction or set of instructions to the database
to retrieve certain data. A Query by Example is one of the simplest
types
of queries but also one of the most useful. You will use Queries by
Example
throughout XpertMart™ to find a specific item in
the
Items Catalog when you do an Item Lookup a the
Point
of Sale; to find a specific customer by last name in the Client Catalog; or to pull up all Invoices from a specific date (using the
XpertDate™ tool) in the Documents>Invoices
Catalog.
When you do a Query By Example, you are giving the system search
criteria
and you are asking XpertMart™ to find every
record
in the catalog (which is in fact a table in the database) that also has
that
search criteria. A Query by Example might ask the system to retrieve
all
Items that have the color "Blue". You are giving XpertMart™ an example ("Blue" in the Color field) and then
asking
(or querying) the system for all records that have exactly the same
criteria
as the example does ("Blue" in the Color field).
There are four steps to a Query By Example. Assuming you are already
in
the catalog where you want to do the query
(in
this case the Items Catalog), you will need to:
1) Press the Clear Form Button
in the toolbar at the top. This will clear every field in the
catalog;
2) Find the field(s) where you are going to enter your example. In
this
case, the Color Field.
3) Enter the "example" or search criteria, in this case the color
Blue.
4) Press the Query by Example Button
in the toolbar at the top.
Once you've followed those four steps, XpertMart™
will "pull" all records from the database table that match the search
criteria
you defined. In this case, XpertMart™ displays
all
Items in the Items Catalog that have the
Color Blue.
You can see how many records match the search criteria by looking at
the
Records Bar at the bottom of the catalog. The Selected
Records Box in the middle indicates that there are 23 Items in the
Items
Catalog that have the Color Blue. This is out of a total number of 521
records
in the catalog. Use the green navigation buttons in the toolbar at the top of the catalog to
scroll
through the 23 records.
When you are done looking at the records that you pulled with your
Query
by Example you will want to press the See All Records Button
in the catalog toolbar to once again see every entry in
the catalog and
not just the subset from your last query. You will know you are once
again
seeing all records when the number in the Selected Records Box matches the
number
in the Total Records Box, as
shown below:
You can enter more than one search criteria into a Query by Example. In
the
example below the user is doing a Query By Example for Items that are
the
Color Blue and belong to the Style "Impressions." Note that when you
open
the Style drop-down menu the
photo and
description of every Style flashes by in the catalog as you scroll down.
In this particular case there are 11 items that match both criteria:
When you do a Query by Example and none of the records in the database
table
match your search criteria (for example, no item exists in the color
you
gave as an example) you will see the following error message:
Copyright © 2002 XpertMart