This article aims to provide information about fields in Knack tables, including how to effectively manage them, utilize them within your app, and configure their settings.
This article covers the following topics:
What are fields?
Knack uses tables and fields to structure your data.
Fields are utilized to specify particular attributes of a table. Think of a field as similar to a column in a spreadsheet.
It is recommended to add a field for every attribute you wish to store for your table.
Tip: Learn more about the different field types offered in Knack in our Field Types article.
Where do I access fields?
To access fields, navigate to the Data section in the Builder. Next, you can choose the table where you would like to access the existing fields.
The fields for that table will be shown in the center column:
Managing Fields
Adding a Field
To add a field, click the “Add Field” button at the top when viewing a table, and then select a field type.
Notes:
- Keep in mind that when naming fields, those names will be used while building your Live App, so we recommend keeping them reader-friendly. We also think it's important to pick field names that are very clear to anyone with Builder access.
- There is currently no set maximum amount of fields you can add to one table. However, there are limitations on the number of columns that one table can possess; learn more about this here.
Field types are categorized in the following way:
-
Text: Short Text, Paragraph Text, Rich Text, and Text Formula
-
Number: Number, Currency, Equation, Auto Increment, and Formulas
-
Choice: Multiple Choice and Yes/No
-
Date: Date/Time and Timer
-
File: File and Image
-
Personal: Person, Email, Address, Phone, and Signature
-
Other: Rating, Link, Signature, and Connection
Editing a Field
From the "Data" section in the Builder, select the table where you want to edit a field. To edit the field's settings, click on the field or click the ellipses icon and select “Settings” from the dropdown:
You will then be directed to the field's settings:
Note: The appearance and settings of the Edit Field modal pop-up will vary depending on the field type.
Converting the Field Type
To change the field type, simply click on the ellipses icon to the right of the field name, and select "Change Field Type":
Caution: Changing the field type has the potential to update any existing records associated with that field, as Knack will try to convert the existing data if possible.
For example:
If you change a field's type from short text to link, Knack will utilize the short text as the URL component of the link field. However, changing a field from paragraph text to a file will result in the data not being migrated, and the field's data will be cleared for each record due to it not being a compatible field type conversion.
You will receive a message in when selecting a field type that is compatible with the existing field type. Conversely, a warning message in red will be displayed when the field type is not compatible:
Tip: To learn more about changing field types, see our article here.
Deleting a Field
From the Data section in the Builder, select the table where you want to delete your field. To delete, select the ellipses icon and select “Delete” from the dropdown.
You will be asked to confirm before the field is deleted.
Caution: If you delete a field, it will be removed from the entire application. This means that all data associated with that field will be deleted, and the field will no longer be visible in any of your views.
Moving a Field
To rearrange the order in which fields appear, simply click and drag the desired field up or down in the table's list of fields:
Copying a Field
Fields in a table can be copied by clicking the down arrow icon next to the table’s name and selecting the "Copy" option:
You'll be given the option to copy the fields from that table to a new or existing table. To copy the fields into the same table, select the "Existing Table" option and select the table from the dropdown:
Then, you can select which fields you want to be copied:
Tip: To learn more about copying fields and tables, see our article here.
Field Settings & Rules
Field Settings
Every field type has different settings options. See our Field Types article to learn more about the different field settings available for each type.
Field Keys
Each field in your application is assigned a unique field key, such as "field_1". You can easily view and search for field keys in the Data section of the Builder.
To display the field key beneath the field names and enable searching by field key in the Builder, simply click on the icon highlighted below:
Tip: You also can view the field key in your browser's address bar while viewing the field's settings.
Validation Rules
Validation rules are implemented to ensure accurate data input from users and maintain data integrity.
Tip: To learn more about validation rules, see our article here.
Conditional Rules
Conditional rules are a powerful tool that allows you to automatically assign values to a field based on the values of other fields. This allows you to create dynamic and interactive forms that adapt to user input.
Tip: To learn more about conditional rules, see our article here.
Maximum Number of Fields in a Table
If you encounter an error while trying to add a field to your table, such as receiving a message that says, "You have exceeded the maximum number of fields for this object", it is because there is a current limitation of 1,580 columns per table.
What are columns?
To avoid getting overly technical, the error message we have included refers to fields rather than columns. In terms of the field type, fields can include anywhere from 1 to 9 columns for each of those field types that are added to your table.
The number of columns per field type varies. For the field types not mentioned below, there is only one column per field:
- Address: 9
- Person: 5
- Phone: 5
- Date/Time: 4
- Timer: 3
- Email: 2
- Link: 2
- Signature: 2
What can I do to avoid reaching the limit of fields?
There is almost always an opportunity to divide your data fields into more than one table without negatively compromising the functionality of your app and how your data is organized. Our Planning Your Tables article can offer valuable insights and serve as a helpful guide to assist you in the essential process of planning your tables.