The Query Roadmap Query is a tool that allows easy grouping of

The Query Roadmap
Query is a tool that allows easy grouping of records. With query we can group records that fit into
criteria that we define. There are several steps involved in creating a query, this roadmap can help us
create the query we need by reviewing the concepts behind the process.
What records are we looking for?
Let’s define what records we are looking for. Are we looking for all gifts last month? Or are we looking
for all members who have donated between $500 and $1,000 this year? Write down a clear statement
of the records you wish to include in your final results. Be sure to be specific, this will serve as our guide
to build the correct query.
What type of record are we grouping?
Creating a Query
The first thing we’ll need to decide is what type of record we want to group. Take a look at the
statement we wrote down earlier. Do we want to group Constituents, gifts, participants? The type of
record we want to group is our source record and determines our Query type.
For example, let’s look at this statement: I need to see a list of all Members who have given a gift of at
least $100 this year. Here, I’m trying to group all members. In other words, I’m trying to group all
records of Constituents who are members, therefore I will create a Constituent query.
The format of our query can either be dynamic or static. Static queries do not refresh themselves, but
dynamic queries do, meaning they will constantly add new records to their results. If we build a query
and later add a new record that should fit into that query’s criteria, that record will be pulled into the
results automatically only if the query is dynamic.
The Query Screen
Before we begin building the query, take a moment to look at the diagram below and get familiar with
the terminology and layout of the query screen.
Tabs
Available Fields Window
Filters Window
And/Or Buttons
Move fields
up/down
Remove criteria
fields
Edit
highlighted
criteria field
Add/Remove
Parentheses
What records do we want to include?
The Criteria Tab
Identifying the Filters Needed:
Now that we’ve added a new query, we need to define our criteria that will tell the program which
records to include or exclude. Let’s take a look again at the statement we created earlier. This
statement can help guide us through defining the criteria for our query. Think of this statement in terms
of its segments. Each segment will show us which filters we need to include in this query.
Let’s look at our example:
Statement: I need to see a list of all Members who have given a gift of at least $100 this year.
Now let’s break it down into segments:
I need to see a list of all Members who have given a gift of at least $100 this year.
Each of these segments represents a detail in my statement that I need to make sure I account for in my
query filters. Using these segments, we can begin to map what fields we’ll need:
I need to see a list of all Members who have given a gift of at least $100 this year.
Constituency
Code
Gift
Amount
Gift Date
Now that we have all of the segments broken down and the fields identified, we can begin to build the
query criteria. Search through the Available Fields window to find the fields we need. Let’s take a look
at how the fields for my segments are mapped:
Constituency Code- Constituency>Constituency Code
Gift Amount- Gifts>Gift Amount
Gift Date- Gifts>Gift Date
Using Operators
Once we have identified the fields needed to build our query, we’ll need to use operators to filter those
fields. These filters together create the criteria that direct our query to include or exclude certain
records. Going back to our example, here are my operators:
I need to see a list of all Members who have given a gift of at least $100 this year.
Constituency Code- Constituency>Constituency Code equals Member
Gift Amount- Gifts>Gift Amount greater than or equal to $100
Gift Date- Gifts>Gift Date equals This Year
Positive and Negative Operators
One important thing to remember when working with these operators is that in one query, we want to
stick with using all positive or all negative operators. Using positives and negatives in the same query
could potentially confuse the program. Positive operators are those that do not include the word “not”,
for instance, “equal to”, “between” and “blank” are all positive operators. Negative operators are those
with the word “not”, for instance “does not equal” and “not blank”. If our query requires both positive
and negative operators, let’s get creative with the operators to try to get around this. For example, if
we don’t want to include any Board Members, instead of using “Not equal to Board Member” we can try
using “One of” and select the remaining Constituencies. If this does not give us the results we need, we
can create two separate queries, one that groups the records we do want, one that groups the records
we don’t want, and use the merge function get our final desired results.
Summary Information
Query also offers the ability to group our records based on summarized information, for instance, we
can group all Constituents who have given over $500 total or who have given at least 5 gifts. This
function then allows us to further filter the summary information, so we can group only Constituents
who have given at least $500 this year, or who have given at least 5 gifts to a specific fund.
We can find the Summary Information fields at the bottom of the Available Fields window. When we
choose which summary field we want to use, an Edit Field Criteria window appears and through this
window we can apply filters to the field. For instance, if we only want to include Constituents who have
given over a certain amount in a certain date range, we would choose the Total Amount of Gifts field
and specify our criteria, then we would filter it by Gift Date so the program only looks at gifts from that
date range when calculating the total.
Summary
Information
Fields
To group all Constituents who have given over $500 this year, here’s how my criteria would look:
Summary Information>Summary for Gifts>Total Amount of Gifts is greater than $500
Gift Information>Gift Date equals This Calendar Year
Linking Filters with AND and OR
Most of the time when we build queries, we’ll have more than one filter, as in our example. We’ll link
all of these filters together using the words AND and OR, we can use our original statement as a guide
for when to use each word. If the segments in our statement are separated by “or”, then we’ll use OR.
Returning to our example, none of the segments are separated by “or”, and if we inserted the word “or”
between any two segments, it would fundamentally change the statement. Here is how our example
looks:
I need to see a list of all Members who have given a gift of at least $100 this year.
Constituency Code- Constituency>Constituency Code equals Member
AND Gift Amount- Gifts>Gift Amount greater than or equal to $100
AND Gift Date- Gifts>Gift Date equals This Year
However, if we wanted to group records who fit into this scenario OR that scenario, we’d use OR to link
the criteria. For example, if we wanted to group any Constituents who are board members or gave over
$1000 last year, we would link the first scenario (board members) with this second scenario (gave over
$1000 last year) using OR.
Parentheses
If we need to use both AND and OR in one query, we also need to include parentheses to help group the
statements. The parentheses will group the statements for the program and show it how to look at the
scenarios. Using the example in the previous paragraph, if we wanted to group any Constituents who
are board members or gave over $1000 last year, we would need to show the program what the
scenarios are. The first scenario is that the Constituent is a board member, the second scenario is that
they gave over $1000 last year. The filters that correlate to each of these scenarios need to be grouped
with parentheses:
(Constituents who are board members) OR (Constituents who gave over $1000 last year)
Here is another example, this time the scenarios are linked with AND:
I want to group any Constituents who are board members and have either given over $1000 or have
attended three events.
(Constituents who are board members) AND (Constituents who have either given over $1000
OR have attended three events)
When we put together our criteria, any filters for the first scenario need to be grouped together with
one set of parentheses and any filters for the second scenario need to be grouped with another set of
parentheses. If one scenario is made up of only one filter, it is not required that it has parentheses
around it, but it may be helpful to include them anyway to help map out our statements. Sometimes we
may have multiple sets of parentheses in one query, we may even have a set of parentheses within
another set, depending on how many scenarios and AND/OR statements we are using.
What do we want to see in the results?
The Output Tab
Now that we have our filters in place, we must decide what we want to see in our results. Because
Query is a grouping tool rather than a reporting tool, what we choose to see in the output will serve to
help us verify the records in the results rather than to report on characteristics of these records. We
choose our output fields in much the same way as we choose our filters: we’ll find the field we wish to
output using the Available Fields window. When we’ve found the desired field, we can drag and drop it
into the Output window. Depending on what we choose to output, the query may return duplicate
records in the results, because query is a grouping tool rather than a reporting tool, this is nothing to
worry about.
How do we want the results displayed?
The Sort Tab
On the Sort tab, we can choose which fields we want the results to sort by and whether it should be in
ascending or descending order. If we do choose to sort by one of our output fields, we can easily find
these in the Query Fields section of the Available Fields window. Just drag and drop these fields into the
Sort By window.
Do the results look ok?
The Results Tab
Let’s take a look at the Results tab. Browse through the results and make sure the records in the results
are correct. If we are unsure, we can always take a closer look at a few records in the results and make
sure that they fit into our criteria. Keep in mind that query is a grouping tool, so depending on our
output fields, we may see duplicates in the results, this is nothing to worry about. Now we can pull this
query into Export or Reports to report on these records, or Mail to include these records in a mailing.
Common Query Fields
Below are some maps for commonly used query fields. Use these examples as a guide to build queries
that fit your needs.
Constituent Query Field Mapping
Constituency Code- Constituency  Constituency Code
Membership Program- Membership  Current  Program
Membership Category- Membership  Current Category
Gift Amount- Gifts Gift Amount
Gift Date Range- Gifts  Gift Date
Gift Type- Gifts  Gift Type
Gift Campaign- Gifts  Campaigns  Campaign ID or Description
Gift Fund- Gifts  Funds  Fund ID or Description
Gift Batch Number- Gifts  Batch Number
Pledge Balance- Gifts  Pledge Balance
Email Addresses- Addresses  All Addresses  Phones  Specific Phones  Email  Email
Number
Key Indicator (Individual or Organization?)- Constituent Information  Key Indicator
Assigned Solicitor- Relationships Assigned Solicitors  Specific Record
Solicit Code- Solicit Codes  Solicit Code Description
Zip Code- Addresses All Addresses  ZIP
Revenue Query Field Mapping
Gift Amount- Gift Information Gift Amount
Gift Date Range- Gift Information  Gift Date
Gift Type- Gift Information  Gift Type
Gift Campaign- Campaigns  Campaign ID or Description
Gift Fund- Funds  Fund ID or Description
Gift Batch Number- Gift Information  Batch Number
Pledge Balance- Gifts  Pledge Balance
Participant Query Field Mapping
Registration- Participant Information  Registration
Participant Type- Participant Information  Participant Type
Registration Fees Paid- Registration Fees  Amount Paid
Invited?- Participant Information  Invitation
Specific Event- Events  Description or Event ID