Adding a field

Fields are sent between operations to carry data. You can add a field in the Editor by dragging and dropping the field at the Canvas panel. You can then drop the field at an operation to specify it as an input or output for the operation.

About this task

Fields are sent to and from operations. They either hold data of a pre-defined type or are FLAGs, that is empty fields used only for sequencing purposes.

Procedure

  1. Open the Editor.
  2. Select the component on the Components panel.
  3. Drag and drop the component at the Canvas panel.
    The new component is displayed on the Canvas panel.
  4. Click the new component on the Canvas panel.
  5. Enter a name for the component on the Settings panel.
  6. Select Type from the drop-down list.
    Tip: SPARKL fields enforce their type on the data they carry. For example, the integer 1 sent in a string type field arrives as "1". A JSON type field transforms an Erlang map into a JSON object. If the transformation fails, SPARKL sends a default value in the field.
    Table 1. Field types
    Type Description
    FLAG Default value if no other is taken.

    The field serves only sequencing purposes.

    integer The field can contain data of the type integer.
    float The field can contain data of the type float.
    string The field can contain data of the type string. These strings are Erlang character lists.
    utf8 The field can carry a UTF-8 encoded string.
    binary The field can contain data of the type binary.
    boolean The field can contain data of the type boolean.
    term Fields of type term can carry any Erlang data types including Erlang maps, tuples and lists.
    json Fields of type json can carry JSON objects and other valid JSON terms.

Results

A new field is created.

Figure: Defining fields for operations


What to do next

Drag and drop this field at an operation to define it as an input or output of the operation.