Filters 101 - Part 2
A filter relies on 3 pieces of information to work:
•An operator symbol
•The text string or number to compare the database field against
Let's examine each of these 3 pieces a little more closely:
The database field name is defined in the the database structure. If you haven't read up on databases and what they are made of, click HERE for more in-depth information. The Report Builder doesn't assume that you haven't memorized the structure of each database file in your application; the Dictionary window allows you to choose the database field from a list of every database field, making this step very painless to complete. For this small example, let's assume that you have a database field named "City"; it is 2 positions long, and contains only text ("az", "ca", "tx", etc) abbreviations of the 50 states of the United States.
An operator symbol tells the Report Builder what you want to do with the database field that you've chosen from the dictionary. Again, the Dictionary helps you by displaying a list of every operator that are available for building filters. You select an operator symbol based upon the type of information contained in the database file. Some operators are used only on text (such as "="); some are only used on numeric information (such as ">", "<"). For this example we have chosen a text field, so we will use the equal sign for the operator symbol.
The last piece of the filter is one that you provide; only you know what information you want to extract from the database! For this example let's assume we want to print a report of only those customers living in Texas; the abbreviation for Texas is "tx", so we will use "tx" as the last piece of the filter.
So, our first filter resembles this:
INV:State = 'tx'
Granted, this is a very simple filter, but clearly shows all 3 filter components. Let's modify the filter to use a numeric field and a numeric operator. Let's assume that we want to print a report of all customers who have at least a $5000 line of credit with our company. A sample filter would resemble this:
CUS:LOC > 5000
Again, this is a very simple filter that basically shows the structure of a filter.