Common functions:Filter Data (Queries)
Contents
Introduction
The filter tool allows you to display onscreen elements based on specific criteria. For instance, it allows you to filter all the clients being part of a precise category, living in the same city and who do not own companies. This tool is available in all the software managements and is represented by this icon: .
|
Filter Options
Temporary Filter
A "Temporary filter" can not be saved. To see the result later on, you will have to make the filter again.
By clicking on the "Temporary filter" option, this window opens. It allows you to create the wanted filter, based on precise criteria.These criteria are configured from the "Special", "Fields" and "Query" tabs.
Adding a Filter
This filter will be saved to enable you to reuse it without having to reconfigure it in the future. By clicking on the "Add filter" option, the "Add filter" window opens and you will have to name the filter. After naming it, you have to assign it the desired criteria. These criteria are configured from the "Special", "Fields" and "Query" tabs.
It is also possible for the user to configure the visibility of the filter as well as defining who will be able to modify it by clicking on the "Visibility" tab.
NOTE: If the "Network module" is not activated (module allowing more than one user in the software at the same time), this tab is visible, but there will only be one user in the drop-down list.
In this example, the filter is visible and usable by all the users, but only "John Smith" will be able to modify it.
When the filter is created, it is available in the "Current filter" drop-down menu for further use.
Modification of a Saved Filter
If modifications are to be done to the filter, it will always be possible to select it, then to choose the "Modify filter" option from the button.
After, the "Query" tab will allow you to modify it.
Filter Configuration (explanation of the three tabs)
IMPORTANT: Prior to building a filter, it is necessary that you ask yourself several questions in order to know what information will be involved in the query. This help document contains just about all the possibilities accessible in the software.
A filter may contain criteria on:
- Selections (categories, dynamic lists, static lists, etc.);
- Characteristics (client or transaction);
- Links;
- The database fields
MOREOVER, ALL THESE ELEMENTS CAN BE COMBINED BY (AND)'S AS WELL AS BY (OR)'S.
BEFORE CLICKING ON "APPLY", MAKE SURE THAT ALL THE NECESSARY CRITERIA ARE INCLUDED IN YOUR CURRENT QUERY.
"Special" Tab
The section on the left contains three different filter options: "Selection", "Characteristics" and "Links". the section on the right contains the available choices related to the filter option chosen in the section on the left.
Selection
When you apply a filter on a "Selection", you can choose from many "Selection" types (e.g. "Categories", "Dynamic lists", etc.) Furthermore, according to the chosen "Selection" type, there could be more than one check box in the section on he right and it is important to remember that you can check more than one box to build your filter. If it is the case, there are two possible operations: Intersection (AND) as well as Union (OR). All the checked boxes will then be treated as a whole.
Intersection (AND) or Union (OR)
Intersection (AND) allows you to filter all the clients corresponding to all the boxes you have checked.
Union (OR) allows you to filter the clients corresponding to at least one of the boxes you have checked.
- Example using the "Categories" of the filter option "Selection":
- The client Robert has the categories "Volunteer (cocktail)" and "Volunteer (golf)".
- The client John has the category "Volunteer (cocktail)", but he does not have the category "Volunteer (golf)".
- The client David does not have the category "Volunteer (cocktail)", nor the category "Volunteer (golf)".
The "Reversed search" allows you to get the opposite result. You can therefore filter the elements that do not correspond to all the (AND) boxes, or the elements that do not correspond to at least one of the checked (OR) boxes.
Examples of reversed search:
In the selection of the filter, IF the boxes corresponding to the categories "Volunteer (cocktail)" and "Volunteer (golf)" are both checked, as well as the option "Reversed search":
- By using the Intersection (AND), the clients who do not have all the boxes checked will be found (the client MUST NOT have one AND the other boxes checked, the client must therefore have only one or none of the boxes checked.).
The result will include the clients David and John.
- By using the Union (OR), the clients having none of the boxes checked will be found. (The client MUST NOT have one OR the other boxes checked, the client must therefore have none of the boxes checked.).
The result will only include David.
When the wanted "Selection" and operation "AND/OR" are selected, click on " Add condition".
If other conditions are to be added, continue configuring the filter using the "Characteristics" or the "Links" of the "Special" tab, or from the "Fields" and "Query" tabs.
When all the conditions of the filter have been configured, click on " Apply" to view the result onscreen.
Characteristics
When applying a filter on "Characteristics", you must choose between two options: "Client" or "Transaction". Depending on selected option, the characteristics available in the drop-down list on the right will not be the same.
Links
When applying a filter on "Links", it is possible to filter from the information of links between client files.
"Fields" Tab
This tab allows you to make a filter on the information of a field in the database. For instance, the box in which you enter a client's city corresponds to the "City" field. Another way to approach this notion is to consider that if the requested information can not be found in the "Special" tab, it is probably a field.
Types of Fields
Type of fields |
Description |
Example |
Numeric without decimals |
Corresponds to a number/digit without decimals |
Age |
Numeric with decimals |
Corresponds to a number with decimals |
Lifetime cumulative |
Date and/or time |
Corresponds to a date and/or a precise time |
Created on |
Text |
Corresponds to data produced with text characters |
City |
Memo |
Corresponds to a long text field |
Comments |
Logic or short integer |
Generally corresponds to a box to be checked |
Annual receipt |
Use of Operations
The filters on the fields, the characteristics or on the links allow you to use operations; here are their special features.
You can check the option "Reversed search" for all possible operations. This option allows you to invert the possible operations. For instance, "is empty" becomes "is not empty". The label of the operations changes to indicate the exact operation that is going to be performed.
Regular search | Reversed search |
is empty
Means that there is no information in the corresponding field.
For most of the types of fields, "is empty" means that nothing is written in the corresponding field.
In the case of a "Logic or short integer" field type, "is empty" means that the given box is not checked.
is equal to...
Means that the information is identical to the value you have entered.
is between ? and ?
Means that the information is comprised between the specified values.
For a "Text" type of field, the information will be filtered in alphabetical order. So if you enter: between A and Dz, anything that begins with A,B, C or D will be filtered. The z is used to filter the information beginning with D and that contains other characters. Between A and D would be until Cz.
For a "Numeric" type of field with or without decimals, the information will be filtered in ascending numerical order. So if you enter: between 8 and 20, anything that is equal to 8, 9, 10 [...], 19 and 20 will be filtered.
For a "Date" and/or "Time" type of field, the information will be filtered in inclusive chronological order. So if you enter: between 2010/01/01 and 2010/12/31, anything that contains a valid date in 2010 will be filtered.
is in the list...
Means that the information to be filtered corresponds to one of the specified values. To produce a list, you have to enter a value, press "Enter" and enter your second value.
is greater or equal to...
For a "Text" type of field, greater is determined according to the normal alphabetical order.
For a "Numeric" type of field, greater is determined according to the ascending numerical order.
For a "Date" and/or "Time" type of field, greater is determined according to the chronological order.
is smaller or equal to...
For a "Text" type of field, smaller is determined according to the normal alphabetical order.
For a "Numeric" type of field, smaller is determined according to the ascending numerical order.
For a "Date" and/or "Time" type of field, smaller is determined according to the chronological order.
is true
Only applies to the "Logic and short integer" type of field and means the given box is checked.
contains...
Means that the requested information exists in the corresponding field. You can search a letter, a word, a sentence ...
begins with...
Means that the requested information is available at the very beginning of the corresponding field. You can search a letter, a word, a sentence ...
ends with...
Means that the requested information is available at the very end of the corresponding field. You can search a letter, a word, a sentence ...
Others
Only applies to the "Date" and/or "Time" types of fields. The different codes are displayed in the drop-down list.
List of choices
Allows you to choose among all the existing values in the corresponding field. For example, for the "Text" type field "City", you will access the list of all the cities that are already present in the database.
Example of Simple Filter (one condition)
In this example, the filter will find all the elements that contain the portion of word "Winn".
Example of Filter with two or more Conditions
After step D in the previous example, it is possible to add other conditions to the filter. In this very example, in addition to searching the cities containing the portion of word "Winn", we also want to find elements of "M" gender.
Condition (AND) vs (OR)
Example using the following criteria: The "Gender" field must be "M" and the "City" must contain the portion of word "Winn":
The client John is of "M" gender and his city is "Winnipeg".
The client Robert is of "M" gender and his city is "Ottawa".
The client Julie is of "F" gender and her city is "Winnipeg".
The client Mary is of "F" gender and her city is "Toronto".
Condition (AND) implies that the element to be filtered corresponds to both criteria. In the previous example, the search would only produce the client John as a result.
Condition (OR) implies that the element to be filtered corresponds to at least 1 of the 2 criteria. In the previous example, the search would produce the clients John, Robert and Julie as a result.
In Reversed search, we have to invert the criteria.
Example using the criteria: "M" gender and "Winnipeg" city
- By using the Reversed search on both conditions with the (AND) condition, the clients ncorresponding to both criteria will be found. In the previous example, the result would only include Mary, because she is not of "M" gender AND her city is not "Winnipeg".
- By using the Reversed search on both criteria with the (OR) condition, the clients corresponding to at least 1 of the 2 criteria will be found. In the previous example, the result would include the clients Robert, Julie and Mary, because they are either not of "M" gender AND/OR because their city is not "Winnipeg".
- By using the Reversed search on only 1 of the 2 criteria (e.g. Gender: "M") with the (AND) condition, the clients not meeting the "M" criterion AND meeting the "Winnipeg" criterion will be found. In the previous example, the result would only include the client Julie.
- By using the Reversed search on only 1 of the 2 criteria (e.g. Gender: "M") as well as the (OR) condition, the clients not meeting the "M" criterion OR meeting the "Winnipeg" criterion will be found (the client can have one of the two criteria, but not both). In the previous example, the result would include the clients John, Julie and Mary.
"Query" Tab
Prior to applying a filter, it is possible to use the "Query" tab to revise the whole filter.
Process to Filter Several Conditions
To configure a filter that contains several conditions, it is often necessary to dissect the different elements of a statement. These elements will then become the conditions used to build the filter. This process can be done on paper or mentally.
Here is an example of a typical process:
Verbal statement. I want to have a list of the board members, as well as the volunteers (golf) living in Winnipeg.
Interpret the statement. The first step will be to interpret the statement to make sure that the outcome corresponds to the desired result.
My statement could be interpreted in two ways concerning the city:
- I want the board members living anywhere, as well as the volunteers (golf) living specifically in Winnipeg.
- I want the board members living in Winnipeg, as well as the volunteers (golf) living in Winnipeg.
In my example, I chose the second interpretation.
My statement could be interpreted in two ways:
- I want the client to be a board member AND a volunteer (golf) (both at the same time).
- I want the client to either be a board member OR a volunteer (golf) (one of the two).
In my example, I chose the second interpretation.
It could have been necessary to push the interpretation further: Does the board member have to be active or not? Does this person have to hold a particular position?, etc.
Establish the conditions. My statement could be broken down in three distinct conditions:
- The client must be on the board
- The client must be a volunteer (golf).
- The client must live in Winnipeg.
Transform verbal conditions into sofware conditions. If need be, you have to define what each information corresponds to in the software.
- Being a board member: The characteristic "Board member" must be present in the client file.
- Being a volunteer: The category "Volunteer (golf)" must be checked in the client file.
- Living in Winnipeg: The city field must be equal to "Winnipeg".
Establish the interaction between the conditions. Depending on my interpretation, the conditions will interact in the following way:
- The client must be a board member AND live in Winnipeg.
- The client must be a volunteer (golf) AND live in Winnipeg.
- The client must either be a board member OR a volunteer (golf).
In one line: The client must either be a board member OR a volunteer (golf) AND must live in Winnipeg.
To make sure that AND is processed after OR, it is necessary to put in parentheses, using the button, the conditions that must be processed together.
Which gives: (The client must be a board member OR a volunteer (golf)) AND must live in Winnipeg.
Result of the interpretation. | |
| |
A: Contains the list of the conditions of the filter. |
B: Contains the whole query and presents the interaction between each condition. |
Example of Modification of a Query
To modify a query, it is possible to use the buttons , , or to manually modify the query (section on the right) using the keyboard, by clicking where the modification is needed.
Here are some examples of modification using the buttons of the query.
|
E: Click on the "Add parentheses" button in order to add parentheses in the "Query" section. The cursor will blink between the parentheses. |
|
F: Double-click on the first condition to be used. The condition will appear in the parentheses. |
|
G: Click on the button in order to add it after the first condition. |
|
H: Double-click on the second condition to be used. |
|
I: Click next to the parenthesis in order to get the cursor out of the parentheses. |
|
J: Click on the button in order to add it after the parenthesis. |
|
K: Double-click on the last condition in order to add it to the query. |
|
L: Finally, click on " Apply" in order to view the result onscreen. |
Document name: Common functions:Filter Data (Queries)