Think about the data you want to organize. Odds are that you’re thinking about more than just individual records. You’re also thinking about the relationships that tie those records together.
It’s those relationships that give your data meaning and make it useful.
In other words, customer data isn’t just about individual customers. It’s also about what each customer orders, and the items related to each order. Project data isn’t just about projects, but also about which employees work on each project, and their related project assignments. Inventory data isn’t just about inventory, but also about how shipping and receiving affect inventory levels.
We call these relationships connections. When you define connections in Knack, you’re mapping your Knack data with how it works in the real world. 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 login.
- 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.
In this article, we’ll review different examples of how you can use connections in your applications, and more about how to define and manage your connections.
How Do Connections Work In Knack?
In Knack, connections are represented as a special field type. Connection fields allow you to create relationships between objects storing different data types within your app. If you have used other database solutions, you may have used primary and foreign keys, links or joins to create relationships.
One common example is connecting Employee and Company data. When many Employees work at a single Company, this data is related. To show this relationship in your app, you can add a connection between the Employees object and the Company object.
Here are some other examples of related data that use connections:
- Assigning Managers to specific Locations
- Showing Orders related to a single Customer
- Enrolling Students in specific Classes
What Can You Do With Connections?
View Related Data
You can visually show connected data when building your views and pages. This can show hierarchy by adding views to show connected data on a page displaying the details of a single record. Building in hierarchy allows users to drill down and view the details of a record alongside other related data. You can also visually reference connected data directly in a view by choosing which connected fields you want to share on a page.
One common example is showing Contacts connected to an individual Company. By connecting your Contacts and Company records you can build a detailed record profile for a Company.
In this example, we will view the profile for the Company “BASCO”, which shows the list of Contacts connected to that Company.
From the detailed Company profile, we can then go a step further and view the profile for an individual Contact. When viewing the profile for a Contact, we can see any connected Notes that have been added.
Another example here is to show the connected Company data, directly in a table listing Contact records.
- View a detailed profile for a Project record showing connected Tasks, Milestones and assigned Employees.
- View a detailed profile for a Campaign to see connected Donations
- View a detailed profile of an Event to see connected Registrations
- Learn how to show connected records on a page in your Live App.
- Learn more about Detail views to show individual records.
- Learn how to add a “view more details” link to your table.
- Learn more about how to show connected values in views here.
Ensure Users Only Have Access To Their Data
Using connections you can ensure that users only see their data. This means users can login and only have access to records that they have permission to see.
Here are some common examples:
- Assigning Project Managers to specific Projects. These Managers can then login and only see records for the Projects they are assigned to.
- Enrolling Students in specific Classes. Students can then login and see their Connected classes.
Add Workflow And Run Calculations
Automatically connect or update records with forms.
Connections allow you to add automation to your app by creating or updating connected records when forms are submitted.
For example, if you have a form that updates a Job Application record as hired, you can automatically update the connected Job Posting record to show the job search is closed.
- Learn more about using Form views
- Learn how to automatically update or submit new connected records with forms
- Learn how to track which user last updates a record
Share and combine connected data in records
In Knack you can share and combine connected data directly in records. This is done using special field types like text formulas, equations, and formulas.
For example, in the field connecting Contacts to Companies, you can display the name and phone number of each connected Company record.
Run calculations with connected data
You can also use connected values in calculations directly within a record. This can be done using equations and formula fields.
For example, in our Purchase Orders app, we use a formula field to calculate the "Order Total" based on the subtotals of all Line Items records connected to each Order record.
- About text formula fields
- About equations
- About formula fields
- Learn more about adding calculations and logic to your app
- How to show connected values in fields
How Have Others Used Connections?
For many Knack customers, connections have allowed them to leave behind juggling spreadsheets, hours of manual data entry, and constant uncertainty around the accuracy of their data. Take RC Recycling for example.
Mike Richards was wasting 2 hours each day moving data around several spreadsheets to stay on top of his recycling projects, containers, drivers, and more. Using connections to create the necessary relationships, Mike built automated workflows that optimized operations.
Now, Mike always knows the state of his assets, drivers know exactly what they are working on, and customer management is a seamless process. In other words, Mike’s data is no longer working against him - it works for him.
You can read the full case study here.