Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Use the Map processor-type Function to manage input fields , that is, to include or exclude by including or excluding fields forwarded by the function. The input fields can be modified using formulas. New fields are created using formulas, based on input fields, or by adding new information. 

The Map Function has two main features:

  • Manage Input Fields, to keep all input fields in the output, or to exclude all or some input fields from the output.

  • Map Fields, to modify fields using formulas. New fields can be created, based on input fields and formulas.

A screenshot of an example configuration in Map illustrates what it can do:

Image RemovedMap_function_configuration_name_dropdown.pngImage Added

Manage Input Fields

You have three options for handling how input fields are sent to the output:

  1. Keep all -

...

  1. Sends all fields to the output.

  2. Exclude all -

...

  1. All fields are excluded from the output.

  2. Exclude some -

...

  1. Select the fields to be excluded from the output by selecting

...

  1. them in the Fields to exclude drop-down list, or type the field name into the Add field box and click the + button.

...

...

Note!

String literals inside formulas should be inside double quotes ("). Single quotes are not

...

supported.

Map Fields

You can create new fields and modify existing ones, by doing the following:

  1. Enter the name of a new field, or the name of an existing field that you want to modify, in Enter field name. Select the

...

  1. field name from the dropdown list or type the field name into the Add field box and click the + button.

  2. Enter a formula in the Formula input field.
    Once you click into Formula, the Formulas to select and Fields drop-down lists appear.

  3. Add FunctionsOperations, or Fields as needed for your specific field transformation.

  4. Click Preview to view the resulting output.

When references to fields are made in the payload, interpolation syntax must be used: 'payload.value', which refers to the property of the payload. The mapper also supports calls to meta and state streams. Expected The expected map fields entry syntax is the following: 

  • $(payload.value) – Turns the content into a string. 

  • @(payload.value)  – Keeps the data type of the content. 

Interpolation is handled

...

via specific logic used by

...

Usage Engine. All entered expressions are handled in accordance

...

with the built-in rules of the service. For more information, see Variable Insertion

Formulas 

The formulas are divided into two parts: Formulas to select and FieldsFormulas to select contains Functions and Operators.

Note
titleQuotes Use

All entered strings must be used with double quotes ("), single quotes are not supported!

...

Functions

includes the following:

  • Numeric: floor, ceil, min, max, round, modulo

  • String: length, trim, lowercase, upperCase, slice, split

  • Boolean: not

  • Misc: length, Number, firstDefined, firstNonNull

Operators

...

includes the following:

  • Numeric: +, -, *, /

  • Boolean: and, or, <, <=, =, !=, =>, >

  • Branching: if

Fields

...

Includes a list of all input fields.

...

if condition then x else y gives x if condition is true, and y otherwise

Numeric functions and operations

Operation

Description

min(x, …)

outputs smallest of the given input values

max(x, …)

outputs biggest of the given input values

round(x)

round to the nearest integer

round (x,y)

round to the nearest decimal place indicated in y

floor(x)

rounds the  input value to the smallest integer

ceil(x)

rounds the input value to the biggest integer

modulo(x, y)

outputs x modulo y

x + y

numeric addition

x - y

numeric subtraction

x * y

numeric multiplication

x / y

numeric division

Info

...

Round Function Options

The round function uses the following syntax: ROUND(number, num_digits). The arguments that are accepted are the following:

  • number — This is a required parameter. Enter the number to be rounded off. 

  • num_digits — This is an optional parameter. The number of digits to which the number argument is to be processed. 

String functions and operations

Operation

Description

upperCase(s)

convert input string s to upper case

lowerCase(s)

convert input string s to

lower case

lowercase

trim(s)

remove leading and trailing spaces from input string s

length(s)

gives the length of input string s

x + y

concatenate strings x and y

slice(x, y)

get the substring of x, starting at index y (y = 0 is first character)

slice(x, y, z)

get a slice of z characters from the string x, starting at index y (iy= 0 is first character)

split(xx, yy) 

allows for strings to be split by a specific substring into an array.

Example: split(“foo.bar”, “.”) will generate an array containing [“foo”,“bar”]

Array operations

Operation

Function

length(x)

gives the length of x

slice(x, y)

get the slice of x, starting at index y (y = 0 is first character).

slice(x, y, z)

get a slice of z elements from the array x, starting at index y (y = 0 is first character)

Logical (boolean) functions and operations

...

Operation

Description

not(x)

negation of x

x and y true

if both x and y are true

x = y true

if x equals y

x != y true

if x is not equal to y

x < y true

if x is strictly smaller than y

x <= y true

if x is smaller than or equal to y

x > y true

if x is strictly bigger than y

x => y true

if x is bigger than or equal to y

...

Note!

Only = and != comparisons will work for arrays and objects.

The character pairs !=, <=, and => are automatically converted to the Unicode symbols ≠, ≤, ≥.

General operations

Function

Description

firstDefined(x, …)

gives the leftmost value that is defined (that is, not equal to undefined)

firstNonNull(x, …)

gives the leftmost value that is defined and not null

foo

lookup value of input field foo

foo.bar

lookup value of field bar nested inside input foo

Conversion operations

Number(x) converts x to a number (if x is a string representing a number)

...