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.
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 here.
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:
Adding a Field
To add a field, click the “Add Field” button at the top when viewing a table and select a field type.
- 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 maximum amount of fields you can add to one table. However, we suggest learning more about managing your app's performance in this article 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: Name, 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:
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 green 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 ellipses 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. In order 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
Every field type has different settings options. See our Field Types article to learn more about different field settings available for each type.
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 ID icon as seen below:
Tip: You also are able to view the field key in your browser's address bar while viewing the field's settings .
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 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.