Knack uses objects and fields to define your data.
Objects are used to separate your data into common groups. You can think of an object like a spreadsheet or a database table.
Fields are used to define specific attributes of an object. Think of a field as a spreadsheet column. You'll want to add a field for each attribute you want to store for a given object.
You access your objects by clicking on the "Data" link in the top left of your Builder:
Your app’s objects are listed on the left. Click an object to access it.
What Should My Objects Be?
For most apps, figuring out what the objects are is fairly straightforward. But for cases when it’s less clear, here are some good ways to think about your objects:
Consider your fields. It can help by starting at the bottom. List all the fields your app will need to display and manage, then group them into the most logical collections. These collections are your objects.
Think about your pages. If you're adding forms, what inputs will those forms contain? If you want to display a table of records, what will the columns be? Ask yourself if each of the inputs or columns sound like they belong to the same group. If not, you will want to store them in separate objects.
Singular or plural? If you have data that can be plural combined with data that is singular, then you may want break up the plural aspects into a separate object. For example, let's say you want to track job applications (single), but each application can have a job history of previous jobs (plural). In this case, it makes sense to make the previous jobs a separate object that would connect to the application object.
Do you have repeating data? If you are repeating the same information over and over again in your records, you may want to separate that info into its own object and connect it to your original records instead. This way you will only have to update it once.
Add an object by clicking the "Add" button in the left-hand menu:
This will bring up a pop-up to add your object with tabs for 3 options.
Add From Scratch
This tab lets you add your object from scratch:
This means you'll need to add all the object’s fields yourself. This is the most common way to add an object if you are not starting with an existing spreadsheet.
First, give your object a name. We recommend you use the plural version of your object name (e.g. Companies instead of Company). Knack automatically creates a singular version and will use the right version when needed.
Click the "Add Object" button and your new object will be saved and added. You can now start adding fields to this new object. A default "Name" field (e.g. Company Name) is added automatically.
Import a Spreadsheet
If you are starting with an existing spreadsheet, click the "Import a Spreadsheet" tab:
Knack will create a field for each column in the spreadsheet and import each record into the object.
Click here to learn more about importing spreadsheets.
Click on the "Quick Add" tab to select from common object templates:
All the fields listed for each template will be added to your new object. You're free to update or delete these fields after the object is added.
Click on an object from the left-hand menu to edit that object and manage its fields. At the top, there’s a "Settings" link with options for editing each object:
Rename Object: Give the object a different name
Set Display Field: The display field is the field that best identifies the record. This field is used throughout the application when only one field is used to display the record. This defaults to the first field in order.
Make sure the identifying field is something that is easily recognizable, like a name field. ID or auto increment fields are not usually good options, since you are less likely to know a record by its numerical code.
Set Default Sort Order: The default sort order is used to order the records when no other sort order is given. This defaults to the order the record was added, but you can set it to sort by any field.
Note: Object sorting preferences to not apply to records displayed in a view in any manner. Sorting on an object only applies to Builder Data record sorting and for dropdowns used with this object in a connection field.
An object and its fields can be copied by clicking on the gear icon next to the object’s name and selecting the "Copy" option:
You'll be given the option to copy the fields from that object to a new or existing object.
If you choose a new object, you'll be asked to name the new object. If you choose an existing object, you will be asked to select which existing object.
Then you can select which fields you want copied:
When copying a User Role object to another existing User Role object, be sure to NOT copy the five user required fields: Name, Email, Password, User Status and User Roles. If you do, you will find that you are unable to delete the duplicate fields since they are required.
Records on an object are not copied. If the original records are needed on the copied object, an export of the records from the original object in to the copied object will perform this step.
Connect Objects Together
The right column also lists any connections the object has and a link to add a new connection:
When you add a new connection it creates a special connection field in that object:
These fields can be used like any other field throughout your app. If you add a connection field to a form, it will operate like a "look-up," where you can select a record to connect to from the connected object.
Connections open up powerful functionality, such as:
Displaying parent-child records in your app’s pages.
Running formulas to find the totals and averages of child records.
Click here to learn more about what is possible using connections.
Above the list of fields is a "Records" link where you can see all the database records stored in this object:
Click here for more on managing records.
You can delete an object by clicking on the "gear" icon next to the object’s name and selecting the Delete option:
You'll be asked to confirm this action.
Note: Deleting an object is destructive. Deleting an object will remove that object entirely, including any records and wherever it may be used in your live application. So if you have any views displaying records from that object, those views will be removed as well.