Connections Guide

Connections create relationships between tables in your datatables, allowing records to link to each other. This enables powerful data relationships like connecting employees to departments, orders to products, or students to classes.

Table Relationships 

Connection Types

What You'll Learn

  • How to create and manage different types of connections
  • Ways to implement table relationships
  • Methods for choosing optimal connection placement
  • Techniques for connection configuration
  • Best practices for relationship design
  • Solutions for common connection challenges

Table Relationships 

Understanding Table Relationships & Connections 

With Knack, relationships created from Connection Fields can tie your records together. It’s those relationships that give your data meaning and make it useful. Those relationships unlock powerful features that can tell the true story of your data.

For example, with connections you can:

  •  View related data: You can create relationships between your data so that when you view information about a company, you can also view information about all of the contacts that are associated with that company as well.

  •  Ensure users only have access to their own data: Limit the data that users see on a page so that they only see the data that is relevant to themselves. This way, customers only see the orders they have created once they log in.

  •  Run calculations and visually summarize your data: Create reports that show the total sales made in a given month and even how much each salesperson contributed to that total.

πŸ’‘Before creating connections, it is helpful to understand relationships first.

Types of Relationships

Parent Tables (also referred to as Source Tables)

  • Contain primary records
  • Referenced by other tables with Connection Fields
  • 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", with an Incoming Connection to grab the product information they need.

Parent table example

Child Tables (also referred to as 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. When data in the Product Info field is updated, that information updates in the Sales table too.

Child table example

Multi-Level Relationships

Often, connections are created between tables like a chain, where information flows down from the top. Here's an example:

Products β†’ Sales β†’ Suppliers

In this setup, Products sits at the top, Sales in the middle, and Suppliers at the bottom. When you add a connection field to Suppliers that links to Sales, you can access both Sales data and Products data (since Sales is already connected to Products).

It's similar to a family tree - information flows from grandparent (Products), through parent (Sales), to grandchild (Suppliers). This lets you display or use data from any level above in your chain when working with Supplier records.

In the Live App, this structure is helpful when you need to:

  • Show Product details on a Supplier page
  • Filter Suppliers based on Product categories
  • Display combined data from all three tables in a single view

grandparent_child tables

Tip: The connection rules that apply to tables also apply to User Roles. Think about Roles as tables, except they also have login access. While we will use the word table here, know that the same rules apply to user roles.

Here's how connections reveal their true power in Knack's Live App pages, using our Products, Sales, and Suppliers example:

When Building Your DataTable: When you first set up your tables, you create a few simple connection fields - like linking Sales to the Products table, and Suppliers to Sales. Connection fields appear as just one field in your DataTable.

The Live App is where connections are powerful. When you're building pages and adding elements, that single connection field opens up access to ALL the fields from both Sales and Products. For example:

Let's say you're creating a Supplier Details page:

  • You started with just a connection to Sales
  • And now when adding elements (like forms), you can display any Sales information you want: sale dates, quantities, prices, customer details
  • And since Sales connects to Products, you can also show product names, categories, descriptions, inventory levels
  • You're not limited to just one piece of information - that single connection lets you tap into everything in both connected tables

It's like having a master key that unlocks all the data in your connected tables. While the initial connection is simple to set up, its real power comes alive when building your pages. You can:

  • Choose which Sales and Products fields to display
  • Create filters based on connected data (like showing only Suppliers for active Products)
  • Sort using information from connected tables
  • Show or hide elements based on connected values

πŸ’‘ Though there are two tables, you do not add the connection to both tables. The connection only needs to be added to one of the tables to create a relationship between your records.

Connection Types

One-to-Many

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

  1. In the Sales table, add a Connection field that connects to Products
  2. You leave it as a one-to-many type of connection
  3. In the Sales table, you're able to select one Product from the connection field

Then, when building Live App pages:,

  • You can show all Sales related to a Product 
  • You can filter, search, and sort based on that connection

One to Many

Many-to-Many

In a Many-to-Many connection, using a Students and Courses example, an individual Student may be enrolled in multiple Courses. 

And, in a Course record, you can see all the Students connected to it

Then, when building Live App pages:

  • You can show all Courses a Student is enrolled in
  • You can show all Students enrolled in a Course
  • You can filter, search, and sort based on these connections

many-to-many_edu

 

πŸ’‘ Tip: We highly 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 way to structure your data.

Creating Connections

  1. From the Builder, select the target table
    1. In the Records tab, click the Connections icon in the right panel or
    2. In the Fields tab, select Add Field, and choose Connections 
  1. Choose the table to connect to
  2. Configure the relationship: one-to-many or many-to-many
  3. Format Options Based on Relationship Type:

    For One-to-Many Relationships:

    • Option A: Searchable Dropdown:  A single-select dropdown menu where users can search through available options and choose one
    • Option B: Radio Buttons:  A list of options where users can select one choice, displayed as radio buttons

    For Many-to-Many Relationships:

    • Option A: Multi-Select Dropdown:  A dropdown menu that allows users to search and select multiple options
    • Option B: Checkbox List:  A list of options with checkboxes, allowing users to select any number of choices
  4. Required: If enabled, users must make a selection 
  5. Default Selection: None or First Option
  6. Field Description: Add an optional field description that appears in the Builder

Best Practices

Connection Placement

One-to-Many Relationships

  • Create the connection field from the "many" (child) table.
  • This creates a more intuitive data structure where each child record connects to one parent record.
  • Example: Navigate to the Contacts table. Create a connection field. Select the Company table to connect to. Keep the relationship as One-to-Many.
Company (Parent)
└── Contacts (Children with Company connection)

Many-to-Many Relationships

When setting up many-to-many connections, consider these guidelines:

    1. Create the connection from the table you'll access most frequently
    2. Think about your typical user workflow
    3. Structure connections to optimize your most common operations

πŸ’‘ Practical Applications 

Business Directory

  • Companies ↔ Contacts: Navigate to the Contacts table and create the connection field to Companies, if users primarily search for contacts and need to see their company affiliations. Place it on the Companies table if users typically browse companies to find associated Contacts.
  • Contacts ↔ Notes: Navigate to the Notes table if Notes are mostly accessed through Contact records. If users frequently need to see all Notes for a Contact, place it on the Contacts table.
  • Companies ↔ Locations: Navigate to the Companies table and create the connection to Locations, if users typically search by company to find locations. Place on Locations if users more often need to see which companies operate in a specific location.

Order Management

  • Orders ↔ Products: Navigate to the Orders table and create the connection field to Products, since users typically start by creating/viewing an order and then adding multiple products. This supports the natural workflow of building an order.
  • Orders ↔ Customers: Navigate to the Orders table and create the connection field to Customers, since this follows the typical workflow of creating an order for a customer (rather than viewing all orders from the customer side).
  • Products ↔ Categories: Navigate to the Products table and create the connection field to Categories, since users typically browse products and need to see their categories, rather than browsing categories to find products.

Project Management

  • Projects ↔ Tasks: Navigate to the Tasks table and create the connection field to Projects, since users typically need to see which project a task belongs to when managing their work. This also supports filtering tasks by project.
  • Tasks ↔ Assignees: Navigate to the Tasks table and create the connection field to Assignees, since the primary workflow is assigning people to tasks, rather than viewing all tasks for a person (though this is still possible).
  • Projects ↔ Teams: Navigate to the Projects table and create the connection field to Teams, if Team assignment is part of project setup. Place on Teams if you frequently need to see all projects a team is working on.

Tips on Key Decision Factors:

  1. Search patterns: Which table will Live App users search from most often?
  2. Update frequency: Which side of the relationship changes more often?
  3. Record access: Where do Live App users typically start their workflow?
  4. View requirements: What information needs to be immediately visible in the Live App?

Connection Management

  • Editing relationships
  • Updating settings
  • Deleting connections

Connection Field FAQ: Best Practices & Troubleshooting

Essential Connection Basics

Q: Do I need connection fields in both connected tables? A: No, you only need one connection field to link two tables. While double connections are possible in specific cases, adding connections to both tables usually complicates your app structure.

Q: Which table should have the connection field?

For One-to-Many Relationships:

  • Add the connection to the "many" (child) table
  • Example: In a Projects-to-Tasks relationship, add the connection field to the Tasks table

For Many-to-Many Relationships:

  • Place the connection in the table where you'll primarily add/edit connections
  • Example: If you want to assign Managers to Projects from the Project details page, add the Manager connection to the Projects table

Common Questions

Q: Are unique ID/key fields required? A: No, Knack automatically handles all connection management internally.

Q: Will deleting a parent record delete connected child records? A: No, deleting a parent record preserves all connected child records.

Q: How can I display multiple fields in a connection? You can combine multiple fields using a text formula:

  1. Create a text formula that combines the desired fields
  2. Set this formula as the Display Field for the connection

Special Cases: Multiple Connections

ℹ️ While generally not recommended, multiple connections between the same tables can be useful for some very specific scenarios:

  • Family Relations: Track both mother and father for genealogy
  • Multiple Contacts: Record primary and secondary guardians for students
  • Role-Based: Track different roles (e.g., submitter, approver, manager) for documents/projects

Viewing Connection Types

To check your connection types:

  1. In the Builder, open the table's right sidebar and select Connections
    1. The Connections sidebar will remain open as you navigate through tables
  2. In the Builder, open the table's right sidebar and select Data Model. Open the View menu, and toggle the option for Show connection type label to on.

 

⚠️ Important: Exercise caution when deleting connection fields as they are fundamental to your app's structure. Deletion can affect pages, views, or records that use these connections.

Solutions

  • Verify field values
  • Check connection types
  • Validate relationships
  • Test configurations

Related Resources

  • [Table Structure Guide]
  • [Field Type Documentation]
  • [Database Design]
  • [Record Management]

Warning: Deleting connections impacts related records and dependent functionality. Plan modifications carefully.

Tip: Place one-to-many connections on the "many" side for optimal performance and usability.

Advanced Features

Connection Display

  • Custom field labels
  • Filtered connections
  • Conditional display
  • Hierarchical views

Data Operations

  • Bulk connecting
  • Connection imports
  • Relationship updates
  • Data validation