Query Library
  • 23 Apr 2024
  • 3 minute read
  • Dark
  • PDF

Query Library

  • Dark
  • PDF

Article summary

Tired of re-building the same exports, filters, and joins within your queries? These query elements can now be created centrally within a database-specific Query Library.

The Query Library packages institutionally-desired items for users to access throughout the database. This type of packaging allows for all of the appropriate joins, subqueries, calculations, ranks, and sorts to be applied at once. 

For example, should an institution have a unique way of ranking or pulling addresses, applications, devices, gifts, or other elements, the heavy lifting and designing of exports or filters can occur within the library, allowing staff members to select the export or filter anywhere in the database. 

Best Practice

From a functional perspective, the query library eliminates the need to build custom filters and exports each time a new query is constructed. Custom exports and filters (including those that require Custom SQL) can be built in the library and made accessible to end users within Configurable Joins queries.

Creating a Query Library

Create query library using the following steps:

  1. Hover over the Queries / Reports icon in the top navigation and select Queries.

  2. Click Query Library from the right menu.

  3. Click New Library. A popup appears.

  4. In the popup, configure the following settings:

    • Name: Provide a name for this particular library.

    • Type: This defaults to Configurable Joins.

    • Category: Select the category (such as Records) where this library should be available.

    • Base: Select the base (such as Person, Companies and Foundations, or Application) where this library should appear.

  5. Click Save. A query builder appears. Here, exports, subquery exports, filters, subquery filters, and joins may be added as needed to curate the library items.

Sharing Query Libraries

By default, the newly created library is only available to the person who created the library item. The exports, filters, and joins created in the library may be shared with other users, permissions, and roles by leveraging the library's Sharing Permissions

Perform the following to share the library:

  1. Click the Sharing Permissions button.

  2. Click the Add Grantee link.

  3. Select the appropriate Type:

    • User: Search for and select individual users who should have access to the library.

    • Permission: Select a permission that the user will use to access the library (the user should already have the desired permission).

    • Role: Select an existing role. User accounts that have that role will be able to access the library.

  4. Select the appropriate permissions as follows:

    • Display/Run Query: Selecting this option allows library access to users whose permissions are granted under Type.

    • Edit Query: Allows the users to access and modify this particular library item.

  5. Click Save.

Accessing Query Libraries

Libraries display the appropriate exports, filters, and joins when the base of any query matches the base of the library. This includes when main query joins have been added to the base of a query.

For example, if a library was created on a Person base, and a user starts a new query on an Application or Gift base, the library elements will not immediately appear. If a join is added from Application to Person or from Gift to Person, the Person-based library elements appear. If a new query is started on a Person base, the Person-based library items are available immediately. 

To access the query libraries, proceed as follows:

  1. Create a new query with a type of Configurable Joins.

  2. Select the appropriate Category and Base for the desired query.

  3. Click Build Query.

  4. Start building the query as desired.

When adding exports, filters, and joins, a new group of Library Exports appears at the top of the query part dialog, displaying the appropriate user-accessible elements from the library.

What if my query already has joins?

Should there already be existing joins in a query, users have the option to reference the existing pathways or the pathways described within the query library. Slate automatically deduplicates extraneous joins as necessary.

Don’t see your library exports, filters, or joins?

Make sure the appropriate checkbox is selected at the top of the ‘Insert Query Part’ pop-up! These boxes can be used to turn on or off the display of Library query parts.

Was this article helpful?