A Trysquare workspace starts with no models at all. A model is anything your business keeps track of: sites, assets, vehicles, clients, contracts. You create the models, give each one the fields it needs, and link them together. Your forms, assignments and reports are then built on top of them.
This guide walks through creating a model, adding fields, linking models, and choosing how records are labelled and listed.
You need the Manage models permission. Tenant Admins always have it.
Where models live
Models are set up in the workspace settings:
- Click your workspace name at the top of the sidebar.
- Choose Admin settings.
- Under Configuration, choose Models.
The sidebar switches to settings while you are there. Back to app returns you to your records.
Once a model exists, its records appear in the main sidebar under Models, listed by the model's plural name. Each person can drag that list into their own order.
Creating a model
- On the Models page, click Create model.
- Choose an Icon. The icon picker also holds the model's colour: pick a preset or choose Custom colour.
- Enter the Model name, such as "Site", and the Plural name, such as "Sites".
- Add a Description if it helps your team, then click Create model.
Trysquare opens the new model in the model editor, ready for its fields.
Adding fields
In the editor's Schema section, click Add field, give the field a Label, and choose its Type:
| Type | Holds |
|---|---|
| Text | A short piece of text, up to 255 characters unless you set a different maximum |
| Long text | Notes and descriptions, up to 5,000 characters unless you set a different maximum |
| Integer | A whole number, with an optional minimum and maximum |
| Decimal | A number with decimals, with an optional minimum and maximum |
| Date | A date |
| Date & time | A date and a time |
| Yes / no | A yes or no answer |
| Single choice | One option from a list you write |
| Relation | A link to a record of another model |
Every type can be made Required, so a record cannot be saved without a value.
Each field also gets a key, made from its label when the field is created. The key is fixed after that, so renaming the field later changes only its label, and the records behind it stay as they were.
Fields can be dragged into a different order, and each has edit and delete buttons.
Nothing you change in the editor is saved until you click Save changes. Until then the editor shows Unsaved changes, and Discard throws the changes away.
Linking models with a relation field
A Relation field links each record to one record of another model. For example, an Asset can link to the Site it sits on. The relation option only appears once you have at least two models.
When you add a relation, choose which model it Links to, then choose what should happen When a Site is deleted:
- Stop the Site being deleted (the default)
- Clear the link
- Delete the linked records too
Using the example above, the options name the model you linked to. Clear the link is not available on a required relation, since a required link cannot be left empty.
Links show from both sides. Open a site, and it has a tab listing the assets linked to it, with a button to add another.
Choosing how records are labelled and listed
The editor's Record display section sets how records appear around the app.
- Record label is the name each record is shown by. It is built from your fields: click a field's chip to add it, and type any text you want between fields, such as
{reference} {description}. A preview shows the result. Any field type can go in a label except a relation. After you change the label, existing records are updated in the background, and you get an email when that is done. - List columns sets which fields appear as columns in the model's record list.
The Navigation section has Show in navigation. A hidden model stays reachable by its address but is left out of the sidebar, which suits models people rarely browse directly.
Changing a model later
You can change a model whenever your business changes. Changes that would damage records you already have are refused when you save, with a count of the records affected:
- changing a field's type while records hold a value for it
- making a field required while some records have no value
- lowering a maximum length below values already saved
- removing a choice option that records use
- changing which model a relation links to while records are linked
Deal with the affected records first, and the change will save. Deleting a field that holds values asks you to confirm, because saving the model then deletes those values permanently. A field used in the record label has to be taken out of the label before it can be deleted.
A model can only be deleted once it has no records, and while no published form adds records to it.
Working with records
Open a model from the sidebar to see its records:
- Create {model} adds a record. A model needs at least one field first.
- Filter builds filters on any field, matched against all or any of your rules.
- The label column can be sorted.
- The More actions menu has Import data and Edit model.
A record's page shows its fields on the Overview tab, a tab for each model that links to it, and the assignments carried out on it.
Next steps
- Import records from a spreadsheet rather than typing them in.
- Build your first form to fill in against these records.