This article will provide answers to frequently asked questions about connections in your Knack app and offer some troubleshooting tips.
Do I need to add a connection field to both of the tables I want to connect together?
No, you only need a single connection field to establish a connection between two tables. Although double connections can be utilized in rare instances, adding a connection field to both tables can complicate navigation as you progress with building and managing your app.
Which table should I add the connection to?
For one-to-many connections, it generally works best to add the connection to the many, or "child" table.
In the case of many-to-many connections, it is advisable to add the connection to the table from which you want to select the connected record in the Live App. For instance, if you have a one-to-many relationship between Projects and Managers, you could add the connection field to the Projects table, assuming there will be many projects to come.
To establish a connection between two records, determine which record you want to edit in order to connect it to the other record. If you wish to add Managers to Projects from the Project details page, it is recommended to add the connection field to the Projects table.
Tip: See this article about connection types for more details.
Do I need to track unique ID or key fields?
No, Knack takes care of all the connections without the need for key or ID fields.
If I delete a parent record will all the connected child records also be deleted?
No, deleting a parent record does not result in the deletion of the connected child records.
How do I delete a connection?
Caution: Please exercise caution when deleting connection fields. These are foundational elements of your app and can corrupt pages, views, or records that previously used this deleted connection.
My connection field shows as undefined, what is that?
Sometimes, you might come across a situation where a record in one table is connected, but the connection field displays "Undefined" instead of the connected record.
To resolve this issue, navigate to the settings tab of your connected table in the Data section of the Builder. Modify the Display Field, save the changes, and then revert the Display Field back to your desired setting.
You will then see the connected record display properly in the original table.
How can I change what field from my connection table displays in the connection field?
To customize the field displayed in a connection field, simply update the display field of the connected table. See the images above for a preview of this setting.
How can I display multiple fields from one table in a connection field?
You have the ability to customize which field from a connected table is displayed in a connection field by adjusting the display field settings.
To display multiple fields from one table in the connection field, you can utilize a text formula to merge the fields into one. This will allow you to use the text formula as the display field.
Tip: You can find detailed instructions on how to set this up in this helpful guide: How to Show Multiple Fields in Your Connection Dropdown.
What if I need many connection fields between the same two tables?
In exceptional cases, there might be a requirement for multiple connection fields between two tables. Please note that apart from the specific cases mentioned below, we generally do not recommend using double connections.
Potential cases for multiple connections include:
-
For livestock, such as horses or other animals, you may need to track the parentage. In this situation, you can add two connection fields from the Animal table back to itself. One connection field can be named "Father" and the other connection field can be named "Mother".
-
To keep track of two Guardians for every Student, you can add two connection fields from the Student table to the Guardian table. You can rename these connection fields as Guardian 1 and Guardian 2.
-
For tracking document or project roles, you may want to keep a record of the employee who submits, approves, and manages each project. In the Project table, you can add three connection fields to the Employees user role and rename them as Submitter, Approver, and Manager.
-
The example of the Warehouse Manager sample app can be found in our article on Complex Examples.
Tip: If you’re still unsure, please reach out to our support team via the chat widget in the Builder or by submitting this form.
How do I see what type of connection I have?
If you are familiarizing yourself with one of your apps or are learning from one of our many sample apps, it would be helpful to understand how the connections are currently established.
While you're navigating the Data section of your Builder, you can click on the connection in the right sidebar of your table to access the relationship type of each connection that originates from or goes to that table.
Additionally, you have the option to click on the connection field to view the type.