Skip to main content

"createTransform"

The "createTransform" action creates a transform and saves it by name for reuse in MQTT topics and inputs.

Things to know

  • A transform is a process that runs when a record is inserted into an integration table. It allows you to modify the record's data and write the transformed data into user-defined fields in the table. A transform process cannot write to an integration table's built-in fields.

  • You must give each transform a unique name to apply to multiple Integration tables. You can only use a transform with integration tables; it does not work on standard tables.

  • A transform process contains one or more transform steps. Each transform step runs a transform method that modifies data from source fields and stores the result in destination fields.

  • FairCom provides several transform methods in its built-in transformation plugins. You can create additional transform methods by supplying your plugins using the C programming language.

  • You can connect the inputs and outputs of transform steps in any way you desire. The output of one transform step can be the input to another. Once a transform step writes to a field, no other transform step can do so. This ensures transform steps do not overwrite the results of other transform steps, which is essential for auditing and troubleshooting.

  • Each time a record is inserted into an integration table, the server runs each transform step in the "transformActions" property in order from the start of the list to the end.

  • When you apply a transform to an Integration table, the server automatically adds missing output fields. This ensures a transform process has all the fields it needs.

  • When you create or alter a transform process, the server returns an error when a step in a transform process attempts to write its output to the same field that a previous step wrote to.

  • For each transform step, you must set the "inputFields" property to either the "source_payload" or a field that is the output of a previous transform step.

  • Each time you configure an input service, an MQTT topic, or an integration table, you can change the "transformName" property, which changes the transform process for the underlying integration table.

  • Because you can assign the same transform process to many integration tables, be careful when you change a transform process because the change applies to each integration table where it is set. Similarly, the change may affect all output services using the integration table because a transform process writes to an integration table's fields, which output services use to deliver data.

Request examples

Minimal request example

{
    "api": "hub",
    "authToken": "aValidAuthToken",
    "action": "createTransform",
    "params": {
        "transformName": "MinWorkingExample",
        "transformActions": [
            {
                "inputFields": [
                    "aValidFieldName"
                ],
                "outputFields": [
                    "aValidFieldName"
                    ],
                "transformActionName": "tableFieldsToJson",
                "transformParams": {
                }
            }
        ]
    }
}

Response examples

Minimal response example

{
    "result": {},
    "requestId": "00000007",
    "errorCode": 0,
    "errorMessage": ""
}

"params"

The "params" property is an object that contains an action's parameters. Each action defines its own required and optional properties.

Property summary

Table 1. "params" property summaries

Property

Description

Default

Type

Limits (inclusive)

"metadata"

exists primarily for the user interface to find integration information

{}

object

May contain any number and type of user-defined properties

"transformActions"

contains "transformAction" objects

[]

array of objects

"transformName"

contains the name of a transform process

Note

Cannot be one of the FairCom-provided transform names.

""

string

Minimum length: 1
Maximum length: 64


The "metadata" property is an optional JSON object. It exists primarily for the user interface to find integration information. By default, it is an empty JSON object.

Things to know:
  • It contains a flexible set of properties.

  • It typically contains tags and description properties.

Example

{
  "description": "",
  "tags": [""],
  "yourOwnProperties": "usage, purpose, notes, location, etc.",
}

The "transformActions" property is an optional array of "transformAction" objects. It defaults to an empty array.

Table 2. "transformAction" property summaries

Property

Description

Default

Type

Limits (inclusive)

"inputFields"

contains one or more of the fields in the integration table where the value of each of these fields is sent to the transform action as its primary input

Required - No default value

array

"outputFields"

contains one element which is the name of the field that will receive the JSON generated by the transform

Required - No default value

array

"transformActionName"

Contains the name of the transform action.  For example — "siemensUdtPayloadToJSON", "jsonPropertiesToTableFields", "tableFieldsToJson", "jsonToDifferentTableFields"

Required - No default value

string

Minimum length: 1
Maximum length: 64

"transformParams"

contains a unique set of parameters that configure its transformation process

Note

It may be an empty object or contain one or more properties needed by the "transformAction".

Required - No default value

object

Minimum length: 0
Maximum length: 65500

"transformService"

specifies the service that contains the transform

""

string

Any previously defined name of a transform service.



The "transformName" property is a required string that contains the unique name of a transform process, which consists of one or more transform steps.

Things to know:
  • A transform is a process that works like a pipeline where the output of one transformation can become the input for another transformation.

  • The following actions use the "transformName" property to assign a transform to an integration table:

    • "configureTopic"

    • "createInput"

    • "alterInput"

    • "alterIntegrationTable"