An Introduction To Queries - 10 Minutes
A query is how you tell BaseBuilders which records you want to see, whether for working in a list or for feeding a report. This article covers how queries work, the common fields you'll find across modules, and how to save a query so you can run it again.
A Query Is Not a Filter
A common misconception is that you need to show all records first and then start a query, as though you were filtering whatever is on screen. That's not how it works. When you start a new query, your criteria are sent to the database, which finds every record that matches and returns it. What you were viewing beforehand has no effect on the result.
Dates and Named Date Ranges
Almost every module you can query includes a date range. You can enter:
- An end date only to see everything through that date, going back in time. For example, entering August 31 and applying returns time slips through the end of August, with no September time.
- A start date only to see everything from that date forward.
- Both a start and end date for a specific window.
If you plan to save a query and run it repeatedly, use a named date range instead of fixed dates. Options include This Week, Last Week, This Month, Last Month, This Quarter, Last Quarter, This Year, Last Year, Current Pay Period, and Previous Pay Period.
[SCREENSHOT: Create new query for Time Slips with the named date range dropdown open]
Named date ranges are dynamic. Each time the query runs, it checks the current date and adjusts which records it returns, so a saved "Previous Pay Period" query is always current.
Multi-Select Fields
Many fields let you select more than one value. For example, you can select three staff members and the query will return time slips for only those three people.
When selecting staff, inactive users are normally hidden so you only see active users. To query users who have left the firm, turn on the inactive toggle first, then make your selections. Toggling it on or off clears any selections you've already made, so turn it on before you pick.
Radio Buttons and Checkboxes
- Radio buttons allow only one choice at a time.
- Checkboxes allow several choices at once.
Each module has its own set of criteria, so the fields you see will differ between Time Slips, Projects, Invoices, and so on.
Time Slip Classifications
Time Slips has one special set of checkboxes: Project, Proposal, Admin, and Benefit. These are the four classifications of time slips.
- Select a single classification and its specific fields appear. Selecting Project, for example, lets you query on a particular project or set of projects. Benefit lets you select benefit types, and since that field is multi-select, you could return both holiday and paid time off.
- Select more than one classification and the classification-specific filtering is disabled. Only the criteria visible on screen are applied. For example, selecting both Project and Proposal returns all project and proposal time that matches the remaining criteria.
Applying a Query
Select Apply to run the query. Your found set will contain only the records that matched, so if three time slips matched, you'll see three in your found set. Starting a new query always searches the whole database again. Starting a new query with only "Previous Pay Period" selected, for example, returns all time for that pay period regardless of your last query.
If a query finds nothing, use Show All Records and start again. BaseBuilders doesn't know which set you'd want to return to, so it simply shows everything.
To start over inside the query window, select Clear to remove all criteria and begin again, or Cancel to go back without changes.
Queries Differ by Module
Each module offers criteria suited to its records. Invoices, for example, include fixed fee billings and services, along with statuses such as Draft, Approved, and Issued.
Projects have so many criteria that they don't fit on one page, so the query window is split into tabs:
- General information, where you enter your main criteria.
- A set of billing checkboxes, such as projects with a fee remainder or those with additional services or extra work.
- Tags and custom fields. Custom fields are unique to your firm, so the ones you see will be your own.
Saving a Query
If you'll want to recall a query again and again, save it. After applying the query, choose to save it, give it a descriptive name, and decide who can see it:
- Public queries are available to everyone.
- Private queries are visible only to you.
When you open the query list in a module, you'll see both the private and public queries available to you. Use your judgment about which queries everyone needs and which are unique to you.
Managing Saved Queries in Settings
All saved queries in the system are listed under Settings, in Data Management, under Query Sets. You can also build new queries here rather than on the fly in a module. Queries you save from a module will appear here too.
From this list you can duplicate a query or edit it. Keep in mind that a change to a saved query changes it for everyone. The query may also be used by a saved report, so editing it changes that report's results as well.
Best Practice
Use named date ranges in any query you plan to save, so it stays current without editing. Before editing a shared saved query, check whether it's used by a saved report, since the change will affect everyone who uses it. When a query comes back empty, use Show All Records and start fresh rather than trying to adjust criteria blindly.
Summary
A query searches the whole database for records matching your criteria, regardless of what you're currently viewing. Date ranges can be fixed or dynamic named ranges, multi-select fields let you choose several values, and radio buttons and checkboxes behave as single- and multiple-choice. Time slips add classification checkboxes, and selecting more than one disables classification-specific filters. Each module has its own criteria, and Projects split theirs across tabs. Queries can be saved as public or private, managed under Settings > Data Management > Query Sets, and edits to a saved query apply to everyone, including any saved reports that use it.