Introduction
Data Modules in Corteza are built with data fields. There are many different types of data fields. Each Field Type can have:
Attributes. These allow us to customize a Field Type to our needs e.g. turn a number into a measure of currency or weight.
Sanitizers. These allow us to clean up data before it is saved e.g. round a number with 7 decimal places to a number with 2 decimal places.
Validators. These allow us to determine if a field value is a valid entry or not e.g. someone's age should not be a negative number.
This guide concerns itself only with Attributes for the named Field Type. Sanitizer and Validators are the subject of a separate guide which can be found here.
To access Data Modules, click on the "Admin Panel" on the top of the left menu bar in any Corteza app.
The Record Selector Field Type
The Record Selector field type allows you to create relationships between modules. Once the Record Selector Field Type has been selected in the "Edit Module" page, click on the Wrench icon to the right of the field type in order to tailor its attributes.
In the "Record Selector" tab you can configure the relationship. For example, you are in a "Note" module and you want to make it possible for a "Contact" record to have many "Note" records. In this case, you select the "Contact" module in the "Record Selector" tab.
In the "Note" record you want to show the name of the "Contact" (which reads better than an ID). For this we have a "Module field" option, right under the drop-down where you selected the module. For the "Contact" you would select the "Name" field. Now, when the end-user sees the "Contact" field in the "Note" record, it will show the Contact's name. This value is also clickable, allowing the user to go directly to the "Contact" record.
The next option is "Quote fields on search". Here you can define what field you want the end user to search on. If the user is creating a new "Note" record, it can select the "Contact", but there might be hundreds of contacts. So, let's select "Name" here. Now, the end user can type to search for a contact. "Jes" would return all "Contact" records that have a "name" starting with "Jes", such as "Jess", "Jenny", etc. You can leave this field unselected to allow searching on all fields.
Finally, it is also possible to prefilter records for viewing (e.g. "My records only" rather than seeing all record relationships). This is achieved with the Corteza Query Language, a simplified SQL.
Once you have made your choices, hit "Save and close". When back in the "Edit Module" page, hit "Save" again to save the Module changes.