Connecting Records Together

In this article, we aim to provide valuable insights on how to establish connections between your Knack records.

This article covers the following topics:

 

What are connections?

Connections serve as the vital links that connect your records together. By utilizing connections, you have the ability to construct sophisticated applications that are user-friendly and easily manageable.

Connections enable you to link and associate various entities together, such as:

  • Invoice #123 with customer Jamie Thompson

  • Student Maria Rodrigues with school Summer Heights High

  • Employee Jo Richards with Department Sales

These connections enable the creation of dynamic pages that exclusively display each user's relevant data, ensuring the privacy and relevance of their information. For example, by connecting invoices to specific users, you can build a customer portal where each user logs in to see and pay their own invoices:

 

To establish a connection between your records, there are two stages involved:

  1. Establish a connection between two tables, allowing for the linking of records.

  2. Link individual records by utilizing the connection field.


The article About Connections covers the first stage of creating a connection between two tables in-depth, along with many examples of how connections are used.

In this article, we will discuss the second stage - utilizing connection fields to effectively manage relationships between records. We will explore the various options provided by Knack to establish connections between records.

 

 

Managing Record Connections

When you establish a connection between two tables, the connection field becomes the means by which you manage the relationship between individual records. The appearance of the connection field in your Live App will depend on the format that is set on the field- it can be displayed as a dropdown menu or a radio button.

together5

together3

The dropdown option allows users to easily scroll through or search the connected records before selecting one.

However, if the connected table has 500 or more records, the only option available will be to search the connected records.

 

Note: When you establish a connection between two tables that already have records added to them, the resulting connection field will be empty. You will need to set the connection values in order to link the records together.

 

 

Connecting Records Together

In order to establish a connection between two records, you will need to choose a record from the connected table by utilizing the connection field on a child record.

When working in the Builder, it will appear as follows:

together6

There are numerous methods available for establishing connections between records in Knack. You can connect records:

  • In the Records section of the Builder

    • Edit records individually in the Records tab

    • Import connections with a file (.CSV, .JSON, .XLSX, .XLS, or Google Sheets)

    • Automatically connect records using scheduled tasks

  • In your Live App, using form views

    • Edit the connection field in a form

    • Automatically connect records using record rules on the form submit

  • In your Live App, using grid views

    • Inline edit connection fields

    • Automatically connect records using record rules when inline edits are made

  • Via an integration

    • Insert connected records using a third-party service like Zapier or Make

    • Edit the connection field via the API

Tip: In the section below titled Connecting Records in Your App, you will see how to connect records using the above techniques.

 

 

Editing a Connection Between Records

Editing a connection between records follows a similar process to connecting records.

Here are the available techniques for editing a connection between records:

  • In the Records section of the Builder

    • Edit records in the Records tab

    • Edit connections during the import

    • Automatically update record connections using scheduled tasks

  • In your Live App, using form views

    • Edit the connection field in a form

    • Automatically update record connections using record rules on form submit (only some actions)

  • In your Live App, using grid views

    • Inline edit connection fields

    • Automatically connect records using record rules when inline edits are made

  • Via an integration

    • Edit the connection field via the API

 

Disconnecting Records

To disconnect records in the Builder, simply remove the connected value from the connection field. When the field is empty, the record you are viewing will no longer be connected to any other record: 

togetherseven

Deleting a connection between records is very similar to editing record connections.

The following techniques are available for disconnecting records:

  • In the Records section of the Builder

    • Edit records in the Records tab

    • Edit connections during the import

    • Automatically update record connections using scheduled tasks

  • In your Live App, using form views 

    • Edit the connection field in a form

    • Automatically update record connections using record rules on form submits (only some actions)

  • In your Live App, using grid views 

    • Inline edit connection fields

    • Automatically connect records using record rules when inline edits are made

  • Via an integration

    • Edit the connection field via the API

Note: As with editing connections, you cannot currently edit a connection field to disconnect records using Zapier.


 

Display Field

The values that appear in the connection field represent a field in the connected table. This is what we call the display field.

The display field can be changed in the table settings of the connected table.

Tip: It is recommended to set the display field to a unique and easily identifiable field.
 

For example, for a connection between contacts to companies, you may choose the company name field from the companies table as the display field. That way, when you’re viewing or editing the connection field of a contacts record, you’ll see the company name of the company records:

togethereight

 

Tip: You can learn more about using connections fields and their settings here.

 

 

Connecting Records in Your App

In this section, we will delve into the various methods that can be used to connect records together. 

Tip:  For more information on the different ways to utilize connections in your app, please see our article here.

 

From the Records Tab in the Builder

Within the Records section of the Builder, you have the ability to view, edit, add, and delete the records in your database. 

You can view records for one table at a time by selecting the table on the left: 

together9

To modify a connection field in the Builder, simply click on the connection field itself to edit it inline. Additionally, you can expand the record to edit the entire record and it's field values by clicking on the expand icon next to the specific record.

You will have the option to choose a record from the connection table and establish a connection to it:

together10

You can utilize this method to:

  • Connect records for the first time

  • Edit the existing connection between records

  • Disconnect records

Tip: For more information on editing records in the Builder, see our see our article here. 

 

 

During Import

You can use an import to create and edit connections to other records. When you import records into an existing table, you can choose which field from that table to match the column in your import file.

Likewise, you can also match a column in your file to a field in a connecting table. Knack will then use that match to find a record to connect to:

together11

This technique can be utilized to:

  • Connect records for the first time

  • Edit the existing connection between records

  • Disconnect records

Tip: For more information on importing connections, see our Importing Connections article.

 

 

Using Scheduled Tasks

Scheduled tasks are an effective method for automatically updating record connections. These tasks can be used to connect to another record, update existing connections, and insert new connected records.

together13

Note: Tasks can be accessed with a Pro plan or higher. They are automatically enabled when you upgrade to a plan that includes Tasks.

For more information, please visit our pricing page.

One scenario when you may use scheduled tasks to connect records is with daily evaluations. Some companies require managers to evaluate their employees on a regular basis.

You have the option to utilize a task to automatically insert a new evaluation record that is connected to each active employee record on the first day of every month. Furthermore, you can configure the task to automatically connect the new evaluation record to the manager who is connected to each employee.

Here is an example within the Builder of how to set up a task to insert a connected record:

togethertwelve

You can utilize this method to:

  • Connect records for the first time

  • Edit the connection between records (not available when inserting connected records)

  • Disconnect records (not available when inserting connected records)

Tip: For more information on using tasks, see our scheduled tasks article.

 

 

Directly in Form Views

In your Live App, you have the option to create form views for your users, allowing them to easily edit record connections. By including the connection field as a form input, users can select a record from the connected table to establish a connection with the record in the form.

This functionality is available in forms for both adding and editing records. 

together14

You can utilize this method to:

  • Connect records for the first time

  • Edit the existing connection between records

  • Disconnect records

Tip: For more information on using forms in Knack, see our About Form Views article.

 

 

Using a Form’s Source

Forms can be configured to automatically establish connections between records. When creating a new record using a form, you have the option to automatically connect the new record to the record on the current page or to the logged-in user.

This functionality is available if there is an opportunity to insert connected records on that particular page.

As an example, if you have a contact directory where contact records are connected to their associated company, you have the option to include a form on the company details page. This form allows you to add new contact records, automatically establishing a connection between the new contact and the company record you are currently viewing.

together15

Note: Forms that automatically connect new records to the page’s record must be located on a details page. Forms that automatically connect new records to the logged-in user must be located behind a login view.

 

To determine if a form is automatically configured to establish a connection for a new record, you can check the data source. 

together16

Tip: For more information on using forms in Knack, see our About Forms Views article.

Additionally, for more information on using the data source, see our article here

 

 

Using Record Rules on a Form or Grid

Record rules are an effective technique for automatically establishing connections between records using a form or grid view. Similar to tasks, record rules have the ability to update the record within the form or grid, modify connected records, and insert new connected records.

This feature is often used to track the last user who made edits to a record. For example, you can set up a record rule to connect a record to the logged-in user when they edit an invoice using a form.

As an illustration, let's consider the scenario where we add a record rule to a form called "Edit Invoice". In this case, the invoice table is associated with the manager user role, granting us the ability to establish a connection between the invoice record and the manager user who made the most recent edits: 

together17

You can utilize this method to:

  • Connect records

  • Edit the connection between records (not available when inserting connected records)

  • Disconnect records (not available when inserting connected records)

Tip: For more information on using record rules in Knack, see our Using Record Rules article.

Additionally, for more information on using connections to track what user edits a record, see our Track Which User Last Updated a Record article.

 

 

In Grid Views

Records can also be edited inline on grids. If the connection field is present on a grid, you can enable inline editing so users can edit the record connections.

Inline editing on a grid can also trigger the record rules mentioned in the above section.

together18

You can utilize this method to:

  • Connect records

  • Edit the connection between records

  • Disconnect records

Tip: For more information on enabling inline editing, see our Grid View Settings article.

 

Using Zapier

Zapier is a powerful service that enables you to seamlessly connect third-party software with your Knack account, allowing you to automate the transfer of records between these services.

By leveraging Zapier, you can effortlessly insert connected records into your database. For instance, if you utilize accounting software, you can effortlessly send paid invoice records to your Knack app, automatically establishing a connection between the invoice and the corresponding customer.

You can utilize this method to:

  • Connect records

  • Edit the connection between records

Tip: For more information on using Zapier with Knack, see our Use Zapier to Insert Connected Records article.

 

 

Using the API

Our API allows you to create custom integrations between your business tools and Knack. With the API, you can make requests to create, retrieve, update, or delete records in your Knack apps.

This means you can use our API to insert a new connected record and edit the connection field between existing records. The functionality is similar to what you would get from Zapier, but our API offers greater robustness and customization options.

You can utilize this method to:

  • Connect records

  • Edit the connection between records

  • Disconnect records

Tip: For more information on using Knack’s API, see our Developer Documentation.

 

Notes & Troubleshooting

For detailed troubleshooting tips and FAQs, see this article: Connections: Troubleshooting & FAQs

How To Guides