In addition to performing the simple searches discussed in the previous sections, nxqddb provides some special types of searching. These more advanced search techniques are discussed in this section.
Each nxqddb window contains a Search for field(see figure 4.1). This field is expressly used for searching and is therefore only active while in Search mode.
Figure 4.1: The Search for Field
For example, suppose you type Rex in the Search for field. The people returned would be those records that contained Rex in any field. Suppose you had the following people(see table 4.1), each one of these people would be returned from the search since they each have the value Rex in at least one field.
Table 4.1: Search data example
nxqddb provides the capability to search on more than one field. There were some sample searches discussed earlier that illustrated this technique.
To search on more than one field, you follow these steps:
For example, suppose you would like to find a person named John Doe who lives in Ludlow. You could find this information by following these steps:
Note, the results returned will be those instances that match on all three fields. That is, you'll receive only those instances where the Name is John Doe who lives in the city of Ludlow. In other words, the result is the intersection of instances whose (1) first name equals John, (2) last name equals Doe and (3) city equals Ludlow.
There is no limit to the number of fields that you can search on. You can search on any field displayed in the window, provided that you can tab into the field while in Search mode.
You can specify more than one search field value simply by delimiting the values by commas. For example, suppose you wanted to find all the people whose name is either Timothy OR Carol. You would do these steps:
Of course, you can have multiple search fields whereby each search field can specify one or more search values. This type of search basically combines the above two search techniques. Lets clarify this with an example.
Suppose you'd like to find all people that have a last name of either Simpson or Flanders and who live in the city Springfield or Chicago. To find these instances, you would follow these steps:
There is no limit to the number of fields or the number of search field values.
You can do searches on date fields. The format for entering dates is mm/dd/yy where (1) mm denotes the month, (2) dd denotes the year, and (3) yy denotes the year.
Valid date entries are shown below:
You may also enter dates related to some date. nxqddb provides some keywords (or short cuts) for specify dates. These shortcuts are listed in table 4.2.
Table 4.2: Generic Search For Field
You may also use the day-of-week keywords Monday, Tuesday,
Wednesday, Thursday, Friday, Saturday, and
Sunday.
Month names are also fine. For example,
the following are all valid input to a date attribute:
The input ``next tuesday'' does not mean this coming (or current) Tuesday, but the one after. The keyword ``tuesday'' means the coming (or current) Tuesday.
nxqddb provides the ability to perform range searches on Numeric and Date fields. Since our guestbook doesn't have any numeric fields, we'll create a new schema for handling, say invoices. When we refer to the ``Invoices'' window, we'll be referring to the nxqddb window displayed using the schema shown in figure 4.2.
Use Reduced Attribute Identifiers
Use Cached Hashing
CacheSize = 500
HashSize = 20000
Number verbosename "Invoice Number" type integer
Client (
ID verbosename "Client #" type integer
Name
)
Date type date
Time exclude
DayOfWeek verbosename "Day of Week"
Pet (
PetID verbosename "Animal #" type integer
PetName verbosename "Animal Name"
Doctor
Personnel
EntryCode verbosename "Entry Code"
Items (
Qty type integer
Code
SvcType
Desc verbosename "Description"
Taxable exclude
Price type real format "%.2f" exclude
Total verbosename "Line Total" type real format "%.2f" exclude
DiscountedTotal verbosename "Discounted Total" type
real format "%.2f" exclude
)*
Subtotal type real format "%.2f" exclude
)*
Subtotal type real format "%.2f" exclude
Discounts type real verbosename "Discounts" format "%.2f" exclude
Tax type real verbosename "Sales Tax" format "%.2f"
Total verbosename "Invoice Total" type real format "%.2f" exclude
PaymentType verbosename "Type of Payment"
PaymentAmount verbosename "Payment Amount" type real format "%.2f" exclude
PreviousBalance verbosename "Previous Balance" type real format "%.2f" exclude
AmountDue verbosename "Total amount due" type real format "%.2f"
Actually, the schema shown in figure 4.2 is taken directly from a commercial application -- Faunix. If you'd like to view the schemas(and complete source code for that matter), visit http://www.hsdi.com on the internet.
A range search is performed by keying the lower limit(or value) followed by a dash followed by the upper limit.
For example, suppose you wanted to find all the invoices in the range 100 through 200. The following steps show you how to find this range of invoices including the invoice 100 and invoice 200. nxqddb range searches return the lower and upper limits.
You can also perform range searches on date fields. Similarly to range searching on numeric fields, you specify a range search by keying in the lower limit value (or starting date) followed by a dash, followed by the upper limit(or ending date).
The following examples illustrate range searches on date fields:
There are many times that you may want to find information for an entire month. To simplify this task, nxqddb provides two special functions: @firstofmonth(today) and @lastofmonth(today).
These two functions find the first/last day of the month. For example, suppose today's date was say 10/11/96. Then, nxqddb would convert the following:
These two functions are especially useful for storing search templates that are run every month. Using these special functions allows you to not have to re-key the date fields each time you perform your search.
nxqddb allows you to search for instances where a field does NOT equal some specified value.
Suppose you would like to find all people except for those named Smith. To accomplish this, follow these steps:
nxqddb provides regular expression searches. A regular expression search is a way to specify wild cards in your search. To accomplish this searching technique, you use the dot-star character combination(.*).
If you enter .* in a search field, nxqddb will return all the instances in the database. For example, if you're in the AddressBook2 window and enter .* in any field, then all the people will be displayed in the search results listbox.
Here are some sample searches and their results using the .* wild-card.
If you want to build more complex searches, you can group search values using curly braces({}).