1. Apps
  2. Core Concepts
  3. Foundational understanding

Understanding Connections in Knack

Connections are powerful fields that allow you to create relationships between different tables in your Knack app. This guide explains how to create, manage, and utilize connections effectively to build robust data relationships.

About Connections

Table Relationships

Types of Connection

Display Fields

Creating Connections

Managing Connections

Best Practices

Understanding Connections

Data becomes truly powerful when you connect it. Just like in the real world, the most valuable insights come from understanding how different pieces of information relate to each other.

Think about:

  • A customer's story includes not just their details, but what they've ordered and their purchasing patterns
  • A project comes to life when you can see which employees are working on it and track their assignments
  • Inventory makes more sense when you can connect it to shipping records and receiving data

In Knack, we use connections to map these real-world relationships. They're the bridges that link different types of data together, unlocking powerful features that let you:

  • View related data: See the complete picture - like viewing all contacts associated with a company in one table
  • Control user access: Ensure Live App users see only what's relevant to them - for example, customers viewing just their own orders after logging in
  • Create powerful insights: Generate reports that tell the full story, like monthly sales totals broken down by salesperson

How do connections work in Knack?

We make connections simple by using a special type of field -  a Connection field. If you're familiar with databases, think of these like the links or joins you've used before, but more intuitive.

Here are more examples of what you might connect:

  • Employees with their Companies
  • Managers with their Locations
  • Orders with their Customers
  • Students with their Classes

Each connection helps tell a more complete story about your data.

Tip: You need at least two tables to create connections. See our [Tables Guide] for more information about creating and managing tables.

Understanding Table Connections & Relationships

Types of Table Relationships

Parent (Source) Tables:

  • Contain primary (source) records
  • Is referenced by other tables
  • Example: A Products table in a Retail Store app

In the example below, the Products table acts as a Parent table that other tables can reference through Connection Fields.

When tables like Sales and Inventory Alerts include Connection Fields linked to Products, they can access and display data from the Products table.

Think of it like the Products table is the source of truth, with Sales and Inventory Alerts "reaching in" to grab the product information they need.

Tip: Parent tables have incoming connections. Other tables are looking into this table for data.

Parent table example

Child (Target) Tables:

  • Connect to parent tables via a connection field
  • Contain related records
  • Example: Sales table connected to Products

When we look at the Sales table, it contains a Connection Field that links out to the Products table.

Think of the Sales table as reaching outward to fetch data from Products - that's why we call it an outgoing connection. The Sales table is the "child" because it depends on and references data from the "parent" Products table.

This means each sales record can automatically pull in relevant product details without duplicating that information across tables.

Tip: Child tables have outgoing connections. They are looking out to other tables to gather data.

Child table example


Multi-Level (Nested) Relationships

Think of the example below as a chain of connections flowing from Products down through Sales to Suppliers. Each level can access data from the level above it:

Products (Grandparent) → Sales (Parent/Child) → Suppliers (Grandchild)

Suppliers, as the grandchild table, can pull in Sales data through its Connection Field. Since Sales is already connected to Products, this creates an indirect link that lets data flow from Products through Sales and ultimately to Suppliers. It's like a family tree where information gets passed down through the generations - from grandparent (Products), through parent (Sales), to grandchild (Suppliers).

grandparent_child tables

Tip: One table can have a variety of connections. In other words, a table could be a parent, child, and/or nested type of table!

Connection Types Guide

  1. One-to-Many
    • One record connects to multiple records in another table
    • Example: One Sales record can have one Product. There can be many Products in the Sales table.

In a One-to-Many connection between Products and Sales, each Sales record connects to exactly one Product, but a single Product can be referenced by many different Sales records.

It's like having a dropdown menu in the Sales table where you can select one Product from the complete list of available Products. For example, if you sell coffee mugs, the same mug product could appear in hundreds of different sales records, but each sale can only be for one specific product.

One to Many

2. Many-to-Many

    • Multiple records in one table connect to multiple records in another table
    • Example: Many sales representatives can be assigned to a region. Each region has multiple reps, and each rep can be assigned to one or more regions.

Below we have a Sales Regions table and a Sales Team table:

In the Sales Region table, each region can have a whole team of sales reps assigned to it, and each rep can work in more than one region.

If you are looking at Southeast's region record, you might see it's connected to three different sales rep records, while some of those sales reps might also be assigned to the Northeast.

many_to_many

Caution: For best results, we recommend using either One-to-Many or Many-to-Many connections, even though other options are available. These two connection types cover most use cases and provide the most robust and efficient ways to structure your data.

Display Fields

When selecting options in a connection field, you will find the records from the connected table displayed in a dropdown menu, showing the value from that single field. This is known as the display field, and each table has a designated display field.

The default Display field is the first field on the table that was created. 

To update the display field for a table, head to that table's fields tab. Select the ellipses on a field, and click Make this the Display Field.  There are some fields that are not allowed to be Display Fields, like calculation columns. 

Edit the Display field when needed so you can select the appropriate records via Connection fields in the Builder. 

You can build out pages in the Live App to include the Display field, as well as other fields accessible via Connection fields.

In the images below, we see that the Product Info connection field pulls in values from the Display field in the Product table.

Tip: When connecting records, you can choose the most recognizable field as your display field. For example, you may want to use Product Name rather than Product ID - this makes it much easier to select the right record when making connections.

Display field 2

display field 3

We can change a table's Display field in the Fields tab.

display field

In the Products table, if we change the display field to SKU, for example, then navigate back to the Sales table and examine the connection field, the values that were previously the Product names have been replaced with the SKU for those records.

display 4

Creating Connections

Adding a Connection Field

  1. Navigate to the Records or Fields section in Builder.
  2. Select your desired (child) table.
  3. Open the right panel, and select the table to add the connection to or;
    - In the records tab, insert a new field by selecting the field header from an existing field, and click to add a new field to the left or right. Select Connection as the field type.
    -In the fields tab, select Add Field, and select Connection as the field type
  4. Select the connection type.

Choosing the Right Table

Follow these guidelines when deciding where to place your connection:

For One-to-Many Relationships:

  • Add the connection field to the child table. Each record in the child table allows to select one value from a list of values from the parent table.
  • Example: Navigate to an Employees table and add a connection field. Select the Company table to connect to. An Employee can belong to one Company, and a Company can have many Employees.

For Many-to-Many Relationships:

  • Add to the table used more frequently
  • Example: Navigate to a Students table and add a connection field to Courses. A student can select multiple courses, and when you go to the Courses table, each course can have multiple students selected. Students will be updated more frequently than courses, so add the connection field there.

Managing Connections

Editing Connections

  1. Go to the Records or Fields tab

  2. Find the connection field and click on the ellipsis (⋮) in the field header
  3. Click the ellipsis (⋮) menu 
  4. Select "Edit field settings"

Available settings include:

  • Field name
  • Description
  • Required status
  • Default value
  • Relationship type
  • Display format (dropdown or radio buttons)

Warning: Editing connection settings can impact existing relationships and views. Plan changes carefully.

Deleting Connections

1. Navigate to the Records or Fields tab.

2. Find the connection field and click on the ellipsis (⋮) in the field header.

3. Click the ellipsis (⋮) menu.

4. Select "Delete".

5. Confirm deletion.

Caution: Deleting connections will break existing relationships and may affect views and pages that rely on these connections.

Best Practices

Database Design

  • Plan your connections before building.

  • Use meaningful connection names.

  • Review relationships between tables by using the Data Model.
  • Add connections to child tables in one-to-many relationships.

Related Resources