Skip to main content

"alterIntegrationTable" (JSON Action)

JSON hub "alterIntegrationTable" action modifies settings for existing tables that are safe to modify

The "alterIntegrationTable" action alters table settings that are safe to modify.

  • The settings that are safe to modify include:

    • Renaming a table

    • Adding fields

    • Increasing field size

    • Changing table retention policy

    • Changing table metadata

    • Changing a table's transformation pipeline

  • As you refine your integration processes, you may want to rename an integration table to better label the data it holds.

    You can use the "alterIntegrationTable" action with the "newTableName" property to rename an integration table.

    Tip

    You can also use the "tableName" property of the "configureTopic" action to rename an integration table that is automatically created by an MQTT message. This is easy because you can rename the integration table using its MQTT topic.

  • This action cannot shrink the size of fields because this destroys data.

  • This action cannot rename fields because it breaks compatibility with bridges between services (integrations / configurations).

Request examples

Minimal

The minimal example below alters the transform steps in the "myTable1" integration table. It demonstrates all four transform step methods. NOTE: The "transformSteps" property works the same way in the "createIntegrationTable" action.

{
  "api": "hub",
  "action": "alterIntegrationTable",
  "params": {
    "tableName": "myTable1",
    "logTransformOverwrites": false,
    "transformSteps": [
      {
        "transformStepMethod": "javascript",
        "codeName": "convertFahrenheitToCelsius"
      },
      {
        "transformStepMethod": "tableFieldsToJson",
        "mapOfPropertiesToFields": [
          {
            "fieldName": "my_source_field",
            "recordPath": "my_output_field.myProperty"
          }
        ]
      },
      {
        "transformStepMethod": "jsonToTableFields",
        "mapOfPropertiesToFields": [
          {
            "recordPath": "my_source_field.myProperty",
            "fieldName": "my_target_field"
          }
        ]
      },
      {
        "transformStepMethod": "jsonToDifferentTableFields",
        "targetTableName": "my_target_integration_table",
        "mapOfPropertiesToFields": [
          {
            "recordPath": "my_source_field.myProperty",
            "fieldName": "my_target_field"
          }
        ]
      }
    ]
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

The example below shows all possible properties for each type of transform step.

{
  "api": "hub",
  "action": "testIntegrationTableTransformSteps",
  "params": {
    "databaseName": "faircom",
    "ownerName": "admin",
    "tableName": "myTable1",

    "logTransformOverwrites": true,
    "disableTransformSteps": false,
    
    "transformSteps": [
      {
        "transformStepName": "step1",
        "transformStepMethod": "javascript",
        "transformStepService": "v8TransformService",
        "codeName": "convertFahrenheitToCelsius",
        "ownerName": "admin",
        "databaseName": "faircom"
      },


      {
        "transformStepName": "step2",
        "transformStepMethod": "tableFieldsToJson",
        "mapOfPropertiesToFields": [
          {
            "fieldName": "my_source_field",
            "recordPath": "my_output_field.myProperty",
            "binaryFormat": "byteArray",
            "numberFormat": "string",
            "variantFormat": "json",
            "dateFormat": "mm.dd.ccyy",
            "timeFormat": "hh.mm.am/pm"
          }
        ]
      },


      {
        "transformStepName": "step3",
        "transformStepMethod": "jsonToTableFields",
        "mapOfPropertiesToFields": [
          {
            "recordPath": "my_source_field.myProperty",
            "fieldName": "my_target_field",
            "binaryFormat": "base64"
          }
        ]
      },




      {
        "transformStepName": "step4",
        "transformStepMethod": "jsonToDifferentTableFields",
        "targetTableName": "myTargetIntegrationTable",
        "targetOwnerName": "admin",
        "targetDatabaseName": "faircom",
        "mapOfPropertiesToFields": [
          {
            "recordPath": "my_source_field.myProperty",
            "fieldName": "my_target_field",
            "binaryFormat": "hex"
          }
        ]
      }


    ]


  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
    "result": {},
    "requestId": "1",
    "errorCode": 0,
    "errorMessage": "",
    "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
    "result": {},
    "requestId": "5",
    "errorCode": 100,
    "errorMessage": "Not able to find integration table by name [test3/admin/faircom].",
    "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
    "result": {},
    "requestId": "5",
    "errorCode": 100,
    "errorMessage": "Transform pipeline [firstCreateMe] was not found.",
    "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "authToken": "replaceWithAuthTokenFromCreateSession",
  "result": {},
  "requestId": "00000001",
  "debugInfo": {
    "request": {
      "authToken": "replaceWithAuthTokenFromCreateSession",
      "api": "hub",
      "action": "alterIntegrationTable",
      "params": {
        "databaseName": "faircom",
        "tableName": "test1",
        "rebuildTable": false,
        "retentionPolicy": "doNotPersist",
        "retentionPeriod": 1,
        "retentionUnit": "day"
      },
      "requestId": "00000001",
      "debug": "max"
    }
  },
  "errorCode": 12006,
  "errorMessage": "Before you can change the data retention policy, period, or unit, you must use "alterIntegrationTable" and add "rebuildTable": true to the request. WARNING: rebuilding a table disrupts data collection while it rewrites all records."
}

Use the alterIntegrationTable JSON API action to alter settings for existing tables that are safe to modify

API actionsJSON hub APIJSON Actionintegration tables actionsalter integration tablealterIntegrationTable

The "params" property is an object that contains an action's request parameters as defined by a set of properties. Each action defines its own required and optional properties. See System limits for a comprehensive overview of property requirements and limitations.

Table 1. alterIntegrationTable "params" property summaries

Property

Description

Default

Type

Limits (inclusive)

databaseName

(optional) specifies the name of a database.

Defaults to the "defaultDatabaseName" value that is set during "createSession". If no default is set during "createSession", then "faircom" is used.

string

1 to 64 bytes

disableTransformSteps

(optional) prevents the server from running an integration table's transform steps on newly inserted records.

false

Boolelan

false
true

logTransformOverwrites

(optional) logs when a transform step overwrites a field that already contains a value.

false

Boolean

false
true

ownerName

(optional) specifies the account that owns an object.

Defaults to the account that created the JSON Action session.

string

1 to 64 bytes

tableName

(optional) specifies the name of a table.

""

string

1 to 64 bytes

transformSteps

specifies an array of transform objects.

Required - No default value

array of objects

0 or more objects

transformSteps
.codeName

specifies the name of a code package that runs when a record is inserted into an integration table.

Required - No default value

string

1 to 64 bytes

transformSteps
.databaseName

(optional) specifies the database that contains an object, such as a table or code package.

""

string

1 to 64 bytes

transformSteps
.ownerName

(optional) specifies the account that owns an object, sucha s a table or code package.

""

string

1 to 64 bytes

transformSteps
.mapOfPropertiesToFields

(optional) specifies field in the table to be mapped to a field containing JSON properties.

[]

array

"binaryFormat"
"dateFormat"
"fieldName"
"numberFormat"
"recordPath"
"timeFormat"
"variantFormat"
transformSteps
mapOfPropertiesToFields
.binaryFormat

(optional) specifies how binary values are returned.

"base64"

string

"base64"
"byteArray"
"hex"
transformSteps
mapOfPropertiesToFields
.dateFormat

(optional) specifies the format of a date or a datetime embedded in a JSON string.

"iso8601"

string enum

"ccyy.mm.dd"
"mm.dd.ccyy"
"mm.dd.yy"
"dd.mm.ccyy"
"dd.mm.yy"
"ccyymmdd"
"yymmdd"
"iso8601"
"utc"
transformSteps
mapOfPropertiesToFields
.fieldName

specifies the name of a field in a table.

Required - No default value

string

1 to 64 bytes

transformSteps
mapOfPropertiesToFields
.numberFormat

(optional) specifies how numbers are formatted in the JSON response message.

"number"

string

"number"
"string"
transformSteps
mapOfPropertiesToFields
.recordPath

specifies the location in a record where the server reads or writes a JSON value.

Required - No default value

string

0 to 256 bytes

transformSteps
mapOfPropertiesToFields
.timeFormat

(optional) specifies how to interpret JSON strings and numbers as time fields.

"hh.mm.am/pm"

string

"hh.mm.am/pm"
"hh.mm.ss.am/pm"
"hh.mm.ss"
20:15:30
20.15&30
20H15M30S
"hh.mm"
"hhmm"
transformSteps
mapOfPropertiesToFields
.variantFormat

(optional) specifies how the server will represent the values of variant fields in its response to your request.

"json"

string

"binary"
"json"
"string"
"variantObject"
transformSteps
.targetDatabaseName

(optional) specifies the name of the database that contains the target table.

""

string

1 to 64 bytes

transformSteps
.targetOwnerName

(optional) specifies the name of the account that owns the target table.

""

string

1 to 64 bytes

transformSteps
.targetTableName

(optional) specifies the name of the target table.

""

string

1 to 64 bytes

transformSteps
.transformStepMethod

specifies the transform method the step will use.

Required - No default value

string enum

"javascript"
"jsonToDifferentTableFields"
"jsonToTableFields"
"tableFieldsToJson"
transformSteps
.transformStepName

(optional) specifies the name that will be assigned to each transform step.

""

string

1 to 64 bytes

transformSteps
.transformStepService

(optional) specifies the name of a transform service, which is the user-defined name for a library (.dll, .so, .dylib) that implements the transform step method.

""

string

1 to 64 bytes



The "databaseName" property is an optional string from 1 to 64 bytes that specifies the database that contains an object, such as a table or code package. If it is set to null or is omitted, it defaults to the default database of the JSON Action session, see "createSession" and the "defaultDatabaseName" property. 

You specify this property when you want to use a different database instead of the default. Your session's account must have the appropriate privileges to access the code package.

This property is useful because objects, such as tables and code packages, can have the same name in multiple databases. This feature allows you to create multiple environments in the same server and reuse the same JSON actions in each environment. For example, you can create "dev", "test", "stage", and "prod" databases on the same server and use the "defaultDatabaseName" or "databaseName" properties to specify the desired environment.

It is an error to set "databaseName" to the empty string "".

If no default database is specified during "createSession", the server sets the "defaultDatabaseName" to the "defaultDatabaseName" value specified in the services.json file.

The optional "disableTransformSteps" property has a true or false value. When true, it prevents the server from running an integration table's transform steps on newly inserted records. It is useful to quickly stop a broken transform process. It disables transform steps without removing them from the integration table.

The optional "logTransformOverwrites" property has a true or false value and defaults to true. When true and a record is inserted into the integration table, the server adds log entries to the log field when a transform step overwrites a field that already contains a value. When true, it protects fields, such as source_payload, from being overwritten accidentally. 

You typically set "logTransformOverwrites" to true when testing transform steps. Once they are working as expected, you can set it to false.

If multiple "recordPath" properties write to the same JSON properties in a "tableFieldsToJson" transform, the server will return an error because "recordPath" cannot overwrite. Multiple occurrences of the "recordPath" property may reference the same property as long as the property is in different fields/tables.

Additionally, non-JavaScript transform steps cannot overwrite protected fields or the source_payload field. The only exception is that a single "tableFieldsToJson" transform step may write to the source_payload field.

You may create transform steps to take the value of one JSON property and store it in multiple fields as long as no previous transform steps have already put values in these fields. Conversely, you may take the value of one field and store it in multiple JSON properties.

Tip

Ensure JavaScript transform steps do not overwrite fields updated by other transform steps.

Do not use the "tableFieldsToJson" transform method to overwrite the source_payload field; instead, use "tableFieldsToJson" to write to a different field and use the "configureTopic" action with the "outputPayloadField" property to configure the MQTT topic to deliver that field's value to subscribers.

Ensure SQL, JSON DB, and other APIs set the value of the source_payload field and do not set field values that transform steps update.

The "ownerName" property is an optional string from 1 to 64 bytes that specifies the account that owns an object, such as a table or code package. If it is set to null or is omitted, it defaults to the account that created the JSON Action session, see "createSession" and the "defaultOwnerName" property. 

You specify this property when you want to use a different account instead of the default. Your session's account must have the appropriate privileges to access the code package. 

This property is useful because objects, such as tables and code packages, can have the same name in the same database as long as different accounts own each object. This feature allows you to create duplicate objects for different users on the same server and reuse the same JSON actions on those objects. For example, an administrator can copy objects from a production environment to her account so she can troubleshoot an issue using the same JSON actions, JavaScript, and SQL code.

It is an error to set "ownerName" to the empty string "".

If no default owner is specified during "createSession", the server sets the "defaultOwnerName" to the "defaultOwnerName" value specified in the services.json file.

The "tableName" property contains the name of the table in the database where the event occurred. It is a non-zero-length string.

See table name in System limits for table naming requirements and limitations.

A table in DBnotify is defined by "databaseName", "ownerName" and "tableName" or by "dataFilePath".

The "transformSteps" property is an array of transform step objects. 

Different actions interpret "transformSteps": [] differently.

  • In the "alterIntegrationTable" action, "transformSteps" is optional. Setting it to [] removes transform steps from the integration table.

  • In the "createIntegrationTable" action, "transformSteps" is optional. Setting it to [] is the same as setting it to null or omitting it.

  • In the "testIntegrationTableTransformSteps" actions, "transformSteps" is required; thus, omitting it or setting it to [] or null is an error.

Each transform step object contains the required "transformStepMethod" property. It also supports the following optional properties:

  • "transformStepName"

  • "transformStepService"

Each transform step method also supports unique properties that are defined below.

"transformStepMethod": "javascript"

  • Required properties

    • "codeName"

  • Optional properties

    • "ownerName"

    • "databaseName"

"transformStepMethod": "tableFieldsToJson"

  • Required properties

    • "mapOfPropertiesToFields"

"transformStepMethod": "jsonToTableFields"

  • Required properties

    • "mapOfPropertiesToFields"

"transformStepMethod": "jsonToDifferentTableFields"

  • Required properties

    • "mapOfPropertiesToFields"

    • "targetTableName"

  • Optional properties

    • "targetOwnerName"

    • "targetDatabaseName"

The "codeName" property is a required string from 1 to 64 bytes. It is the name of a code package that runs when a record is inserted into an integration table. See "codeName" for more information.

It is an error to set "codeName" to the empty string "".

The "databaseName" property is an optional string from 1 to 64 bytes that specifies the database that contains an object, such as a table or code package. If it is set to null or is omitted, it defaults to the default database of the JSON Action session, see "createSession" and the "defaultDatabaseName" property. 

You specify this property when you want to use a different database instead of the default. Your session's account must have the appropriate privileges to access the code package.

This property is useful because objects, such as tables and code packages, can have the same name in multiple databases. This feature allows you to create multiple environments in the same server and reuse the same JSON actions in each environment. For example, you can create "dev", "test", "stage", and "prod" databases on the same server and use the "defaultDatabaseName" or "databaseName" properties to specify the desired environment.

It is an error to set "databaseName" to the empty string "".

If no default database is specified during "createSession", the server sets the "defaultDatabaseName" to the "defaultDatabaseName" value specified in the services.json file.

The "ownerName" property is an optional string from 1 to 64 bytes that specifies the account that owns an object, such as a table or code package. If it is set to null or is omitted, it defaults to the account that created the JSON Action session, see "createSession" and the "defaultOwnerName" property. 

You specify this property when you want to use a different account instead of the default. Your session's account must have the appropriate privileges to access the code package. 

This property is useful because objects, such as tables and code packages, can have the same name in the same database as long as different accounts own each object. This feature allows you to create duplicate objects for different users on the same server and reuse the same JSON actions on those objects. For example, an administrator can copy objects from a production environment to her account so she can troubleshoot an issue using the same JSON actions, JavaScript, and SQL code.

It is an error to set "ownerName" to the empty string "".

If no default owner is specified during "createSession", the server sets the "defaultOwnerName" to the "defaultOwnerName" value specified in the services.json file.

The "mapOfPropertiesToFields" property takes fields in the table and maps them to a field containing JSON properties. It is an array of property map objects. Each object maps a field in a table to a JSON property in another field.

  • Required properties

    • "recordPath"

    • "fieldName"

  • Optional properties

    • "binaryFormat"

    • "numberFormat"

    • "variantFormat"

    • "dateFormat"

    • "timeFormat"

The optional "dateFormat" property specifies the format of a date or a datetime embedded in a JSON string. It applies to user-provided JSON and to server-generated JSON. The server uses it when it needs to transform or convert a date or datetime embedded in a JSON string into a FairCom date or timestamp. It also uses it when it needs to convert a date or datetime field value into a date embedded in a JSON string.

It is an enumerated string with one of the following values: "ccyy.mm.dd", "mm.dd.ccyy", "mm.dd.yy", "dd.mm.ccyy", "dd.mm.yy", "ccyymmdd", "yymmdd", "iso8601", and "utc".

The default value for "dateFormat" is the "defaultDateFormat" property defined in the "createSession" or "alterSession" actions. If it is omitted there, it defaults to the value of the "defaultDateFormat" property in the <faircom>/config/services.json file. If it is not there, the FairCom server defaults it to "iso8601" because the ISO8601 date is the defacto standard in JSON.

The enumerated string defines how the server parses a date in a JSON string and how it writes a date into a JSON string. The following key explains the parts of each enumerated value:

  • ccyy is a four-digit year (0000-9999).

  • yy is a two-digit year (00-99).

  • mm is a two-digit month (01-12).

  • dd is a two-digit day of the month (01-31).

  • hh is a two-digit hour (00-23).

  • . represents one character that can be one of the following values: /, ., or -.

  • "utc", "iso8601", and "ccyy.mm.dd" are the same.

The required "fieldName" property specifies a field in a record. Depending on the context, the server reads or writes the field's value. 

For example, in the "tableFieldsToJson" transform method, "fieldName" is the location where the transform step reads a value that it transforms.  In the "jsonToTableFields" and "jsonToDifferentTableFields" transform methods, "fieldName" is the location where the transform step writes a transformed value.

The "numberFormat" property is an optional, case-insensitive string enum. It defines the format of JSON numbers. The default value for "numberFormat" is the "defaultNumberFormat" defined in the "createSession" or "alterSession" actions. If it is omitted there, it defaults to the value of the "defaultNumberFormat" property in the <faircom>/config/services.json file.

When "numberFormat" occurs in "mapOfPropertiesToFields", it tells the server how to encode or decode a number assigned to a JSON property.

For example, including "numberFormat" in a "tableFieldsToJson" transform step controls if the server encodes a number in a JSON property as a number or a number embedded in a string.

Possible values:
  • "number"

    This causes the server to return numeric values as JSON numbers, such as -18446744073709551616.000144722494 .

    This is most efficient.

    JSON represents numbers are base-ten numbers that may have any number of digits.

    Large numbers, such as 18446744073709551616.000144722494 are known to cause problems with JSON parsers and some programming languages, such as JavaScript, which are limited to the smaller range and binary rounding errors of IEEE floating point numbers.

  • "string"

    This returns the server to embed numeric values in JSON strings, such as "18446744073709551616.000144722494" .

    This is slightly less efficient because it includes two extra double quote characters

    Returning numbers embedded in strings ensures JSON parsers and programming languages will not automatically convert the number to a numeric representation that loses precision, introduces rounding errors, truncates values, or generates errors. This allows your application to control how numbers are processed.

  • Omitted or set to null

    This defaults to "number".

Example request

{
  "action": "someAction",
  "responseOptions":
  {
    "numberFormat": "string"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

The "recordPath" property specifies the location in a record where the server reads or writes a JSON value. It specifies a field name followed by an optional JSONPath. Depending on the context, it refers to a value the server reads or writes. 

For example, in the "tableFieldsToJson" transform method, "recordPath" is the location where the transform step writes a transformed value.  In the "jsonToTableFields" and "jsonToDifferentTableFields" transform methods, "recordPath" is the location where the transform step reads the value that it transforms.

  • The "recordPath" property must always include a field name.

    • The server returns an error when the field name is missing or does not exist.

  • The "recordPath" property may include a JSONPath after the field name.

    • If no JSONPath follows the field, the "recordPath" property refers to the entire field, and the field is not required to contain a JSON document.

    • If a JSONPath follows the field, the "recordPath" property refers to a part of the JSON document inside the field.

Several FairCom APIs, such as the DB and Transform APIs, treat each record in each table as a JSON document. The top-level fields in the record are treated as top-level properties in the JSON document. In other words, you can think of each record as a JSON document, and you can use the "recordPath" property to refer to any field in the record and any JSON property or array item within a JSON field.

When the server writes a value to a "recordPath", it looks for the specified field and JSONPath and does the following.

  • If the specified field does not exist, the server returns an error.

  • If the JSONPath is not specified after the fieldname, the server writes the value directly to the field.

  • If the field's value does not contain a JSON document, the server returns an error.

  • If the JSONPath specifies a property or array item that does not exist in the field's JSON document, the server adds it.

  • If the JSONPath specifies a property or array item that already exists in the field's JSON document, the server replaces the value.

When the server reads a value from a "recordPath", it looks for the specified field and JSONPath and does the following.

  • If the specified field does not exist, the server returns an error.

  • If the JSONPath is not specified after the fieldname, the server reads the entire field value.

  • If the field's value does not contain a JSON document, the server returns an error.

  • If the JSONPath specifies a property or array item that does not exist in the field's JSON document, the server returns null because FairCom's data model treats a missing JSON property the same as one assigned to null.

  • If the JSONPath specifies a property or array item that already exists in the field's JSON document, the server replaces the value.

Note

Unlike "propertyPath", a "recordPath" includes the name of the field that contains the JSON document.

Simple "recordPath" example

For example, a recordPath of "temperature" refers to a field named "temperature".

Example record in an integration table

The following record contains three fields: id, source_payload, and create_ts.

id

source_payload

create_ts

1

{
  "humidity": 
  [
    {
      "temperature": 20.1,
      "pressure": 1003
    }
  ]
}

"2025-07-07T14:14:02.012"

JSON representation of the example record

The following JSON shows how the JSON DB and Transform APIs represent the previous record. The top-level properties are fields in the integration table.

{
  "id": 1,
  "source_payload": 
  {
    "humidity": 
    [
      {
        "temperature": 20.1,
        "pressure": 1003
      }
    ]
  },
  "create_ts": "2025-07-07T14:14:02.012"
}

"recordPath" properties for each value in the example record

"recordPath"

Field Value

"recordPath": "id"

1

"recordPath": "source_payload"

{
  "humidity": 
  [
    {
      "temperature": 20.1,
      "pressure": 1003
    }
  ]
}

"recordPath": "source_payload.humidity"

[
  {
    "temperature": 20.1,
    "pressure": 1003
  }
]

"recordPath": "source_payload.humidity[0]"

{
  "temperature": 20.1,
  "pressure": 1003
}

"recordPath": "source_payload.humidity[0].temperature"

20.1

"recordPath": "source_payload.humidity[0].pressure"

1003

"recordPath": "create_ts"

"2025-07-07T14:14:02.012"

The required "recordPath" property specifies the location of a JSON property in a record. It starts with the name of a field in the table followed by an optional JsonPath to a JSON property within that field.

The optional "timeFormat" property specifies the format of a time or a datetime embedded in a JSON string. The server uses it when it needs to transform or convert a time or datetime embedded in a JSON string into a FairCom time or timestamp. It also uses it when it needs to convert a time or datetime field value into a time embedded in a JSON string.

It is an enumerated string with one of the following values: "hh.mm.ss.ttt", "hh.mm.am/pm", "hh.mm.ss.am/pm", "hh.mm.ss", "hh.mm", "hhmm", "iso8601", and "utc".

The default value for "timeFormat" is the "defaultTimeFormat" property defined in the "createSession" or "alterSession" actions. If it is omitted there, it defaults to the value of the "defaultTimeFormat" property in the <faircom>/config/services.json file. If it is not there, the FairCom server defaults it to "iso8601" because the ISO8601 date is the defacto standard in JSON.

The enumerated string defines how the server parses a time in a JSON string. The following key explains the parts of each enumerated value:

  • hh is a one- or two-digit hour (0-24).

  • mm is a two-digit minute (00-59).

  • ss is a two-digit second (00-59).

  • ttt is a fraction of a second with up to 3 digits of precision (.0-.999).

  • . represents one character that can be one of the following values: :, ., -, or /.

  • "utc", "iso8601", and "hh.mm.ss.ttt" are the same.

The optional "variantFormat" property specifies how the server represents variant fields in JSON. It is an enumerated string with one of the following values: "binary", "json", "string", and "variantObject".

The default value for "variantFormat" is the "defaultVariantFormat" property defined in the "createSession" or "alterSession" actions. If it is omitted there, it defaults to the value of the "defaultVariantFormat" property in the <faircom>/config/services.json file. If it is not there, the FairCom server defaults it to "json".

When "variantFormat" occurs in "mapOfPropertiesToFields", it tells the server how to encode or decode a variant value in a JSON property.

For example, including "variantFormat" in a "tableFieldsToJson" transform step controls how the server takes the value in a variant field and encodes it in a JSON property. By default, the server takes the variant value and stores it as JSON in the JSON property.

For example, including "variantFormat" in a "jsonToTableFields" or "jsonToDifferentTableFields"  transform step controls how the server decodes a value in a JSON property so it can store that value in a variant field. By default, the server takes the value and stores it as JSON in the variant field.

The "json" value causes the server to return a variant field value as JSON or to store JSON in the variant field.

  • When a variant is null, it always sets the JSON value to null.

  • JSON provides a natural representation for most values, such as null, true, false, 3.14, "mystring", [1,2], {"myKey": "myValue"}, etc.

  • JSON does not have a native representation for binary values. Thus, when a variant field contains a binary value, the "binaryFormat" property specifies how the server represents it in JSON, which may be a Base64 or hexadecimal string, such as "486921", or a JSON array of bytes, such as [48,69,21].

The "string" value causes the server to return a variant field value as a JSON string or to store a JSON string value in the variant field.

  • When a variant is null, it always sets the JSON value to null.

  • When a variant contains a numeric value, it embeds the number in a string, such as "3.14".

  • When a variant contains a Boolean value, it embeds it in a string, such as "true" or "false".

  • When a variant contains a JSON value, it embeds it in a string by escaping characters, such as  "{\"key\": \"value\"}".

  • A JSON string can represent a binary value. Thus, when a variant field contains a binary value, the "binaryFormat" property specifies how the server represents it in JSON, which may be a hexadecimal or Base64 string.

  • When you use "variantFormat":"string", you may not use "binaryFormat":"byteArray" because the value must be a string.

The "binary" value causes the server to return a variant field value as a binary value in JSON or to store a binary value in the variant field.

  • When a variant is null, it always sets the JSON value to null.

  • The "binaryFormat" property specifies how the server represents the binary variant value in JSON, which may be a Base64 or hexadecimal string, such as "486921", or a JSON array of bytes, such as [48,69,21].

The "variantObject" value causes the server to return a variant field value as a variant object or to store a value in a variant field as specified by the variant object, which is a standard JSON object that describes the variant value's type, encoding, and value.

  • When a variant is null, it always sets the JSON value to null.

  • Because JSON cannot directly represent a binary value, the "binaryFormat" property specifies how the variant object represents it, which may be a Base64 or hexadecimal string, such as "486921", or a JSON array of bytes, such as [48,69,21].

{
  "schema": "jsonaction.org/schemas/variantObject",
  "value": "ewogICJrZXkiOiAidmFsdWUiCn0=",
  "valueEncoding": ["base64"],
  "type": "binary"
}

The "targetDatabaseName" property is the optional name of the database that contains the target table. See

"databaseName" for more information.

The "targetOwnerName" property is the optional name of the account that owns the target table. See "ownerName" for more information.

The required "targetTableName" property specifies the name of the target table that has its transform steps replaced by this action.

Note

The fully qualified name of a table includes the database, owner, and table names.

The "transformStepMethod" property is a required string that specifies the type of transform, such as the "javascript" transform method that runs JavaScript to change the table's data or the "jsonToTableFields" transform method that extracts values from properties in a JSON field and stores them in other fields.

Note

The "transformStepMethod" property replaces the deprecated "transformActionName" property.

The value of the "transformStepMethod" affects the value of the "transformService" property. The following table defines the possible values of the "transformService" property when combined with the "transformStepMethod". Notice that some transform step methods are built into the server and do not require you to specify the "transformService".

"transformStepMethod" value

"transformService" value

"jsonToTableFields"

null or omitted

"tableFieldsToJson"

null or omitted

"jsonToDifferentTableFields"

null or omitted

"javascript"

"v8TransformService"

"siemensUdtPayloadToJson"

"siemensUdtPayloadToJson"

Note

If the "transformStepMethod" property is set to "javascript", the "transformService" property must be set to "v8TransformService".

The "transformStepName" property is an optional string that assigns a name to each transform step.

The "transformStepService" property is an optional string that specifies the name of a transform service, which is the user-defined name for a library (.dll, .so, .dylib) that implements the transform step method.

This property allows you to register your own transform libraries or use an older version of a FairCom library for backward compatibility.

Transform services are defined in the services.json file under the "transformServices" section. You can add and remove transform libraries to this list, such as your own transform libraries or specific versions of FairCom's transform libraries. Use the "serviceName" property to give each transform library a unique transform service name and use the "serviceLibrary" property to specify the filename of the library that implements the transform step method. On Windows the library filename ends with .dll. On Linux it ends with .so. On MacOS it ends with .dylib. Lastly, you must enable the transform service by setting "enabled" to true.

Example "transformServices" section in the services.json file.

"transformServices": [
  {
    "serviceName": "v8TransformService",
    "serviceLibrary": "v8transformservice.dll",
    "enabled": true
  }
],

Note

If the "transformStepMethod" property is set to "javascript", the "transformStepService" property must be set to "v8TransformService" or to a user-defined transform service name associated with the "v8transformservice.dll" service library.