Setting Up Custom Fields

How to add and edit custom fields

Contents

Custom fields must be added to type setup by the user, they can't be added to Mashoom built in types. Please see this documentation for how to setup new types in the module.

To create a new field, navigate to the Type you want to add it to, then click the "+ Add Field" button.

A new field interface
A new field interface

A field can be any of the following types:

  • Text
  • Option
  • True / False (Boolean)
  • Whole number
  • Number
  • Percentage
  • File
  • Date & Time
  • List
  • Calculation
  • User
  • Currency
  • Address

Give your field a name, then click "Add Field". You'll be able to fully configure that field next.

Editing a Field

Click on one of the fields under the "+ Add Field" button to open up the details. Ever field has different options as to how to set it up. In the example below, we've set up a few different options for our option field, named "Platform step".

Click the name of the field to start editing it. If you change the name of a field all the associated data of the field will remain untouched. The only thing that could break a process is that the export and import tools use the fields name for column headers; be careful no process is reliant on that.

Most fields also have the ability to set a default value, this is the value that a newly created Item would have. Note that this is technically the "what value should the Item have if no value has been set". So, if you create a new Item, make no changes, then change the default value of the type, the Item's value would change.

"Is value fixed" is useful for when you want to disable this value being changed for the type, or if you want to set a default value that can't be changed.

Interface to make changes to a FD field
Interface to make changes to a FD field

Every field can be grouped, click on "Ungrouped" to select from a dropdown of groups you've set up. If you need to add or edit those groups, click Edit groups to the bottom right of the dropdown. Groups are global across all modules, and can be ordered using the up / down arrows to the right of the names.

Group editing popup
Group editing popup

Sub-Type Fixed Values

Fields are inherited in the Types sub-type, as explained in the creating a new type documentation. The field can only be configured in the type is directly belongs to. However, you can fix the value of a field in a sub-type, as shown below. If you have a population of equipment in the Physical Things module, you could for instance have a "module name" for all the pieces of equipment, but have this fixed in a sub type.

Sub-type field fixed value editing
Sub-type field fixed value editing

File Handling

The file input can be used for any file of any size, including photos. It's recommended if you want to collect photos (for instance when using the Forms module to collect photos), to set up the photo file extensions whitelist. This ensures that photos are uploaded in a format that can be printed on PDF documents, as well as ensuring that photos aren't collected in a difficult to hand format like HEIC.

A file data field set up to only allow photo input
A file data field set up to only allow photo input

Lookup Fields

One field can drive the values of another field via a lookup table. A good use case of this is to set up a customer reference / number, which quickly populates the customer name, address, email etc, instead of having to full it in manually each time. It's also good for equipment lookup and for driving calculation parameters.

To change the values of a lookup field, open the field details of the field that is driving the other values. This would be the customer reference in the previous example.

Interface to upload lookup data to a FD field
Interface to upload lookup data to a FD field

The best process is to download the export, even if this is the first time setting up the field. This export will give you the format you need to input the data in. Fill in your data as required, remember that the driving field must contain unique values.

Save your changes to a .csv file (the same format as the export), then upload to Mashoom. You'll see a loading bar as the values get uploaded to Mashoom database. Once that is complete, you can check the information has set correctly by re-exporting the data.

Calculated Fields

Mashoom also supports calculated fields, allowing field values to be driven from other field values, using equations much like spreadsheets. Calculated values can also drive other calculated values and can be any size or complexity.

The interface to update a calculated fields equation
The interface to update a calculated fields equation

Each FD field has a numeric key assigned to it when it's created, you can see this in the top left of the edit box, or in grey to the left of each field when viewing the type.

Fields are used in equations by enclosing the key with curly brackets ("{}"). For instance "{1} + {2}" would return the value of field 1 added to field 2. Field keys are shown to the left of the field name. Static values should be enclosed by square brackets ("[]").

A logic based equation which will return a boolean value
A logic based equation which will return a boolean value

Normal arithmetic symbols (+, -, /, *) can be used in the equation, as well as comparators (<=, <, >=, >). "AND" is specified by "&&" and "OR" by "||".

Calculated fields are refreshed when any applicable field is changed, and this value is stored in the database. This means the historical changes of a calculated field are stored in our database, so it can be reported on, searched for etc.

A list of supported functions is shown, with an explanation of how to use them. This includes an "IF" statement, allowing complex logic when combined with boolean values.

Note that currently when an equation is updated, the values are not automatically updated across the database. The calculation will only take effect when applicable changes are made to each Item.