Skip to main content

Derived Fields in Collection

A derived field is a field that does computations on existing fields to generate derived values.

Accessing the Derived Fields

To access the Derived Field settings, go to the Collection panel in the Left Toolbar of the builder. Open the settings of the collection in whose fields you want to add the derived fields. A dialogue box containing all setting options to modify the collection will open. Select the Derived Fields category and its settings will open.

DrapCode Builder Derived Fields

Types of Derived Fields Functionalities

  • Addition: Creates a field that adds data of the number-based fields.
  • Average: Creates a field that calculates the average sum of the number-based fields.
  • Capitalize: Changes the first character of the subject to upper case and rest of the subject to lower case, if the Rest To Lower field is selected as true. If selected false, then it capitalizes all the characters after space. It can be applied to only string type field.
  • Count: Counts the number of characters in a field whose field type is a static option, dynamic option or reference.
  • Format Date: Allows you to add a field with the specific format of a date.
  • Lower Case: Changes the subject of a string type field to lower case.
  • Multiply: Creates a field that multiplies data of the number-based fields.
  • Slugify: Adds hyphen after each word in a string type field, for example, green-pasture-fields.
  • Subtraction: Creates a field that subtracts data of the number-based fields.
  • Title Case: Changes the subject of a string type field to title case.
  • Trim: Removes whitespaces from the right and the left sides of a subject in a string type field.
  • Truncate: Makes the subject shorter by cutting its length in a string type field.
  • Upper Case: Changes the subject of a string type field to uppercase.

Creating a Derived Field

To create a derived field, open the derived fields settings of the collection bound with the component, such as data table, data list, form, etc. Add a name to the derived field you want to create and choose its type from a dropdown list, which discussed above.

In the example below, the derived field type is chosen as "Addition".

DrapCode Builder Derived Field Creation

Adding a Derived Field

Once, you have created a derived field, it's time to add it to a component. To do so, first, you have to bind the collection, in which you have created the derived field, to a data table, list or group component. In the example below, the derived field is added to a data table.

DrapCode Builder Derived Fields

Now, duplicate the table cells and open the setting of the table cell and choose the previously created derived field as the column field, which will appear automatically in the dropdown list of the Select Column Field setting option.

DrapCode Builder Derived Fields Addition

How does the derived field work?

Once, you have created and added the derived field, it's time to see how the derived fields work.

Make entries in the collection for which you had created a derived field(s) and open the page carrying the data component in the Preview or Publish mode.

In the example below, you can see the derived field, named as Total Job Applications, showing the added data of the fields, Old Applications and New Applications.

DrapCode Builder Derived Field Works