This article will provide a comprehensive guide on effectively working with records in your Knack app.
In order to assist your in quickly finding the information your require, this article covers the following topics:
About Records
In Knack, your data is stored in tables as records which are then composed of fields. Think of this in terms of a spreadsheet. The table represents a single spreadsheet, with each field acting as a column and every record serving as a row in the spreadsheet.
To access and manage records in a table, navigate to the Records section of your Builder and choose the specific table you wish to view records in.
In the Records view, you have the ability to add and manage records in your Knack app. However, a more common approach is to directly add and manage records in the Live App using form views.
To illustrate, here are some typical situations where forms in the Live App are utilized to add records:
-
Parents filling out a form to register children for a camp
-
Job hunters filling out a form to apply for open jobs
-
Employees filling out forms for completing a project
When constructing your app, you have the option to incorporate these form views within the Pages section of the Knack Builder.
Navigating Records
Knack provides multiple methods for navigating, searching your records, and viewing record history.
-
Record Menu: In the Records menu, you can add individual records, import, export, batch update, and delete records.
-
Record Search Menu: In the search menu, you can search by keyword, filter records, see the total number of records, and limit the number of records that show per page while viewing the table.
-
Individual Records: Using the check box, individual records can be selected for specific records to update or delete. Using the two icons to the right of the checkbox, the record history can be viewed for the selected record, and the record can be edited.
Note: Record history is only available on Pro plans and above.
Searching & Filtering Records
While viewing your records in the Builder, you can search by keyword and filter your records directly in the Builder. You can easily clear your search by clicking the "X" in the search bar.
Record History
Record history allows you to access a history of every record change within our data retention window based on your account's plan.
To view a record's change history, first click on the expand icon to the left of that record:
This opens a modal popup with the record's history as seen below:
This display provides the version of the record every time it was changed, highlighting any specific changes from the previous record with a blue highlight.
It also notes the time of the change (in the App's timezone selected in the App's Setttings), the IP address, whether it was updated in the Builder or the Live App, and who updated the record (if applicable).
Note: There's no way to export the record history at this time, but you can create a version history of record changes. If you would like to keep an external backup to reference, you can also copy your record history by highlighting the data in the cells, and then paste it into a spreadsheet.
Adding Records
Records can be added in a few different ways, individually from the Knack Builder, by importing a file, or by adding individual records from the Live App.
Adding Individual Records in the Knack Builder
To add a single record from the Knack builder, select the "+Add Record" button from the top menu. This will open a modal popup with a form to enter the details for the new record.
Importing Records in the Builder
In the Knack Builder, you can add multiple records at once by using the import option. This will allow you to import a batch of records from a CSV file into an existing table.
Click on the "Import" link from the top menu to start the import process. This will open a modal popup to walk you through the importing:
Tip: To learn more about importing records, see our article here.
Adding Individual Records in the Live Application
Individual records can be added directly from the live application with a form view. This is typically the most common method for adding records to an app.
Form views can be accessed and added to pages in your Live App from the Pages section of the Builder.
Tip: You can learn more about using form views here.
Editing Records
Similar to adding records, there is more than one way to update records in both the Knack Builder and the Live App.
Editing Records in the Builder
In the Builder, you can edit individual records records using the pen icon highlighted in the image below or by editing specific fields with inline editing. You can also update many records at once by running a batch update with a task or an import.
Editing Individual Records
Individual records can be edited by selecting the pencil icon next to a specific record. Selecting this icon will open a form in a modal popup, where you can edit the record.
Editing Individual Field Values
When viewing the records for a table, individual fields can be edited with inline editing by selecting a specific cell.
Scheduled Tasks
Using scheduled tasks, records and connected records can be updated based on set criteria. These tasks will run on a schedule or can be run manually from the Builder.
Tip: Learn more about working with scheduled tasks here.
Batch Updates
Batch updates allow you to filter records and perform an update on multiple records at one time.
To start a batch update, select the "Update" option from the top menu.
Selecting the update icon will open the batch update settings in the toolbox to the right and will walk you through the batch update process. From there, you can add filters to define which batch of records will be updated.
Tip: You can learn more about batch updates here.
Imports
You can import records into your existing tables to update records. By select the table you wish to update, you can then select the Import icon from the top menu to begin the process:
When updating records with an import, it's important to choose a column in your spreadsheet that can be matched with one of your fields.
The import will use this column to find any records where the field has the same value. This will need to be a unique field (like ID, email, or name), and your spreadsheet will need to have a column for that field.
The import will then search all the existing records for the value for that column. If it finds a match, it will use that row in the spreadsheet to update that record. If it doesn't find a match, it will insert that row as a new record.
Tip: See our article here for more information on importing records.
Editing Records in the Live App
From the Live App, you can edit individual records with edit forms and by inline editing in grid views.
Editing Records with Form Views
Form views can edit individual records, as well as contain record rules to update records. Edit forms can be added from the pages section of the Builder.
Once a form view has been added, record rules can be added while editing that view. Record rules will allow you to set conditions, which allow you to update the form record or a connected record.
Editing Records with Grid Views
Inline editing can be enabled for grid views in the "Settings" section in the view editor. When this is enabled, users will be able to select a cell on the table and edit that in a modal.
Tip: You can learn more about grid views here.
Exporting Records
You can export your records into multiple formats from both the Builder and the Live App.
When exporting, you can choose from three formats:
-
CSV: CSV stands for Comma Separated Values and is the most common format for manipulating data with a spreadsheet. CSV files can be opened with Microsoft Excel and other spreadsheet programs.
-
TXT: Text format separates values with tabs and can also be opened with Excel and other spreadsheet programs.
-
JSON: JSON is a special JavaScript format commonly used by programmers and developers. This can be a convenient way to back up the records in your database.
Exporting from the Builder
You can export your table records at any time from the Builder. While viewing table records, select "Export" from the top menu, then select the format type.
Exporting from the Live App
You can export records directly from the Live App by enabling exports on any views displaying multiple records (grids, lists, etc.) Exporting can be enabled from the "Settings" section of the view editor in the Builder.
Tip: You can learn more about exporting records here.
Deleting Records
Deleting Records from the Builder
To quickly delete a few records, use the checkboxes to select the records you want to delete and then click the delete icon, which appears above the records.
Batch Delete Records
To delete a large number of records at once, you can use the batch delete feature. This is similar to a batch update and allows you to add filters to select which records to delete.
To start the batch delete process, select the delete icon from the menu, then select the “Batch Delete” option.
Selecting the batch delete option will open a toolbox on the left side of the Builder that will walk you through the batch delete process:
Deleting All Records
You can remove all the records in a table by also using the Delete option. To clear all records from the table, select the delete icon option from the menu, then select the “Delete all records” option.
Selecting this option will open a modal popup, where you will be asked to confirm the delete. Upon confirmation, every record for this table will be immediately removed from the table, and this action can not be undone.
Note: If you are looking to reset auto-increment field counts, deleting a record does not reset the count. Deleting all records from the table will reset the auto-increment count to zero.
Deleting Records from the Live App
Users have the option to add delete links to views in the Live App, which enables them to easily delete records. These delete links can be added from the Actions tab when fields are being added in the view editor.
Note: Deleting a record does not delete any connected records from other tables. For example, if you delete a company record, any contact records that were connected to that company will still exist in your app's database.