Transform Editor

This widget can be used to test a transform action. See Transform section in Actions for more details.

Model

{
    "type": "transformeditor",
    "actions": {},
    "completeMsgObject": false,
    "dataSource": {},
    "editorOptions": {},
    "input": {},
    "toolbars": {},
    "transform": {
        "type": "transform",
        "aggregateOne": [
            {}
        ]
    }
}
Field Description

actions

Optional property, used to implement action pipelines for specific trigger events.

completeMsgObject

Set this property to true if the entire input message should be available to the transform logic. By default, this is false

dataSource

Property used to retrieve data from the system

editorOptions

Additional configuration options for the transform editor. The available options can be found here

input

Defines the input message for the transform editor

toolbars

Optional property, used to add, customise or hide toolbars.

transform

Defines the transform logic

Actions

The actions property of the transform editor widget model can be used to implement action pipelines for specific trigger events. The transform editor widget only supports the general widget action hooks, which can be found here.

Receive messages (Send Topics)

The transform editor widget can receive messages from other widgets. This widget only supports the general topics refresh and update.

DataSource

Refer to the generic widget page for a description of the general principles governing the treatment of data retrieved from a dataSource.

When the message payload returned by a dataSource is defined as an object and the type defined in the payload matches the widget type, then any matching model properties from the payload will be merged to the model. If the type is not defined or does not match the widget type, the input and transform fields are checked for in the payload and merged into the model. However, if the type, input and transform fields have not been defined, then the payload is assigned to input property. Similarly, if the message payload is defined as an array or a string, the content of the payload is merged to the input property in the model.

DataSource Pipeline

DataSource Examples

The sections below contain examples of the message payload returned by the dataSource on the Transform Editor widget and the expected merge behavior when applied to the model.

Message payload defined as an object where the type field matches the widget type

Consider the following message payload returned by the dataSource, where the type field defined in the payload matches the widget type. In this case, any matching model properties in the payload will be merged to the model.

{
    "payload": {
        "type": "transformeditor",
        "captionBar": false,
        "editorOptions": {
            "fontSize": 14,
            "readOnly": true
        },
        "layout": {
            "x": 0,
            "y": 0,
            "w": 48,
            "h": 20
        }
    }
}

Message payload defined as an object with no type field but the input and/or transform field is specified

In the following example, the message payload does not contain a type field. Since the input and transform fields are defined in the payload, these will be the only fields that are merged to the model.

{
    "payload": {
        "input": {
            "name": "Company A",
            "location": "Eindhoven"
        },
        "captionBar": false,
        "transform": {
            "type": "transform",
            "aggregateOne": [
                {
                    "$project": {
                        "company": "$name"
                    }
                }
            ]
        }
    }
}

Message payload, defined as an object, which does not contain the type, input and transform fields

Suppose that the message payload returned by the dataSource on the Transform Editor widget does not contain the type, input and transform fields, as seen in the example below. Then, the content of the payload will be merged to the input property in the model.

{
    "payload": {
        "captionBar": false,
        "editorOptions": {
            "fontSize": 14,
            "readOnly": true
        }
    }
}

This merging behavior is also observed if the message payload is defined as a string or an array.

Toolbars

The transform editor widget supports multiple custom toolbars. For information on configuring custom toolbars, see the toolbars section in the widget documentation.

Tools

The following tools have a default implementation on the transform editor widget.

Icon Name Description

Format Btn

Format

This tool can be used to format the text in the editor if required.

Refresh Btn

Refresh

Refreshes the widget

Spacer

This tool is used to specify the spacing between tools in the widget toolbar. It can be customised using the style and styleByTheme properties.