/
Custom Fields

Custom Fields

Components are re-usable so you can have many instances of the same component with different custom fields settings. You can add, remove and change custom fields for each component.

Custom fields are defined in the config.json file within each component Translator. Once created, these fields can be managed directly from the component card, allowing users to configure runtime values for the component.

Use the config.json file in the Translator to create custom fields and assign default values.

  1. Click on config.json in the project tree.

  2. Click EDIT to edit the fields and optionally include default values.

 

Create your custom field:

  1. Field Name: TestField is the name of the configuration or custom field.

  2. Field Type: Choose a value type. This can be:

    • String: One or more characters of text.

    • Bool: True or False dropdown value.

    • File: Browse to a local file stored on disk.

    • Folder: Browse to a local directory path.

    • List: A dropdown list for choosing from predefined options (comma delimited list).

    • Number: Integers or decimals.

    • Password: A secure field for entering and masking sensitive text like passwords or tokens.

    • Port: A network port number.

  3. Default Value: Optionally add a default value. This will appear on the component card where you can edit the custom field values used when the script runs.

If you do not want to commit these changes, you can change the Using Commit: to DEVELOPMENT in the next step so it will use the changes made in the translator without a commit.

  1. Click the ellipses to change the commit. If you do not want to commit the changes you made, you can change the Using Commit: to DEVELOPMENT so it will use the changes made in the translator without a commit.

  2. The custom field you created in the translator, TestField, now shows up. Now we can change and manage the custom field values for the component to use during runtime.

Additional Information:

To get programatic access of the values of the custom fields, there is this api call:

local Fields = component.fields();

This returns a Lua table with the custom fields and their values for the component.