SALES: 1-800-867-1380
This topic has not yet been rated - Rate this topic

Expressions

Updated: November 21, 2013

Expressions Map Operators

The following table lists the Expression Map Operations available within a Transform:

 

Map Operation Description Parameters Output

Arithmetic Expression

Evaluates a mathematical expression using inputs and constants. Arithmetic Expressions consists of the following operators:

  • Addition

  • Subtraction

  • Multiplication

  • Division

  • Modulo

  • Absolute Value

  • Maximum

  • Minimum

  • Round

  • Square Root

Can have 0 to 100 optional input parameters:

 

Input

A numeric value.

Arithmetic Expression

A mathematical expression defined using the inputs and constants.

noteNote
The maximum length for an expression is 1024 characters.

A numeric value that is the result of the computation.

Logical Expression

Evaluates a condition and outputs the Boolean value of the evaluation. Logical Expression consists of the following operators:

  • Relational Operators:

    >

    <

    >=

    <=

    ==

    !=

  • Logical Negation (!)

  • Conditional AND (&&)

    Conditional OR (||)

Can have 0 to 100 optional input parameters:

 

Input

Can be a numeric value, string value or Boolean value.

Logical Expression

An expression defined using the inputs and constants that evaluate to a Boolean value.

noteNote
The maximum length for an expression is 1024 characters.

True is returned if the Logical Expression returns true. Otherwise, False is returned.

If-Then-Else Expression

Evaluates a statement that results in one of two possible outputs.

Can have 0 to 100 optional input parameters:

 

Input

Can be a numeric value, string value or Boolean value.

Condition

An expression defined using the inputs and constants.

Then Value

If statement or expression is true, this value is used.

Else Value

If statement or expression is false, this value is used.

noteNote
The maximum length for an expression is 1024 characters.

The result is based on a true or false evaluation of the conditional expression.

If true, the Then Value is used. If false, the Else Value is used.

Conditional Assignment

Returns a value from one of two input parameters. If the first input value is True, then a node is created in the output document with the second input value. If the first input value is False, then the corresponding node is not created in the output document.

Requires exactly two input parameters:

 

Condition

An expression that results in a Boolean value. Can be one of the following:

  • Link from tree node

  • Link from a Map Operation

Assign Value

The value assigned to the destination node if the condition is true.

noteNote
This Map Operation can only be connected to a destination tree node.

If the Condition value is "true", then a node is created with the Assign Value input value.

The following table lists additional functions that can be used with any Map Operation:

 

Function Expression Description

Exists

Exists(Source_Node_Name)

Requires a single input that is the element name in the source document. If the element exists, True is returned. Otherwise, False is returned.

IsDate

IsDate(Input1)

Requires a single input of the type string. The DateTime.TryParse() method is used to parse the input into a DateTime object. If the input is parsed successfully, True is returned. Otherwise, False is returned.

IsEmpty

IsEmpty(Input1)

Requires a single input of the type string. If the string is null or empty, True is returned. Otherwise, False is returned. If the input is not a string object, True is returned.

IsNil

IsNil(Source_Node_Name)

Requires a single argument that is the element name in the source document. If the element exists and xsi:nil is set to True, then True is returned. Otherwise, False is returned.

IsNumber

IsNumber(Input1)

Requires a single input of the type string. The Double.TryParse() method is used to parse the input into a double. If the input is parsed successfully, True is returned. Otherwise, False is returned.

noteNote
The comma “,” is supported as the thousands separator and the period “.” is supported as a decimal point.

ImportantImportant
All Map Operation and functions can be used within other Map Operation and functions except Exists and IsNil. Exists and IsNil point to a single node in the source document.

Error and Data Handling

BizTalk Services provides the ability to configure how an error is handled and how an empty or null node is handled. The error handling behavior of the following Expression Map Operations is configurable:

  • Logical Expression

  • Arithmetic Expression

  • If-Then-Else Expression

Steps:

  1. Open a BizTalk Service project or the BizTalk Service Artifacts project in Visual Studio.

  2. Double-click a Transform (.trfm) to open the Transform Designer.

  3. In the Transform toolbar, click Settings.

Error Handling tab

In the Error Handling tab, the following Expression Map Operations have two Behavior options:

  • Logical Expression:

    • Fail map: The entire Transform is aborted. Since Transforms are executed within a pipeline, an error occurs within the pipeline and the error is then sent back to the client that sent the message.

    • Output default value false: If the Map Operation fails, False is returned as the output.

  • Arithmetic Expression:

    • Fail map: The entire Transform is aborted. Since Transforms are executed within a pipeline, an error occurs within the pipeline and the error is then sent to the client that sent the message.

    • Output default value NaN: If the Map Operation fails, NaN (Not a Number) is returned as the output.

    • Output default value 0: If the Map Operation fails, zero (0) is returned as the output.

  • If-Then-Else Expression:

    • Fail map: The entire Transform is aborted. Since Transforms are executed within a pipeline, an error occurs within the pipeline and the error is then sent back to the client that sent the message.

    • Output Null/Zero/False based on type of output: If the Map Operation fails, Null/Zero/False is returned as the output based on type of output.

Null/Empty Data Handling tab

In the Null/Empty Data Handling tab, there are three options:

  • Consider empty nodes in cumulative operations: By default, this is not checked. When not checked, no empty nodes are included in the iteration. When checked, all nodes, including empty nodes, are included in the iteration.

    EXAMPLE: There is a document with 10 <record> nodes. Three of these <record> nodes are empty. When Consider empty nodes in iterations is not checked, the Map Operation returns a value of seven. When Consider empty nodes in iterations is checked, the Map Operation returns a value of 10.

  • Consider empty nodes in iterations: By default, this is not checked. When not checked, no empty nodes are included in the iteration. When checked, all nodes, including empty nodes, are included in the iteration.

    EXAMPLE: there is a document with 10 <record> nodes. Three of these <record> nodes are empty. When Consider empty nodes in iterations is not checked, the Map Operation iterates seven times for the non-empty nodes. As a result, seven <record> nodes are generated in the Target. When Consider empty nodes in iterations is checked, the Map Operation iterates 10 times for all nodes, including the empty nodes. As a result, 10 <record> nodes are generated in the Target.

  • Target Node Generation: If empty nodes are configured to be considered, you choose to generate an empty node in the output or to not generate an empty node in the output. Specifically:

    • Do not generate empty nodes: Default option.

    • Generate empty nodes

    EXAMPLE: There is a document with 10 <record> nodes. Three of these <record> nodes are empty. Consider empty nodes in cumulative operations or Consider empty nodes in iterations are not checked, the Map Operation iterates seven times for the non-empty nodes. As a result, seven <record> nodes are generated in the Target. When Consider empty nodes in iterations is checked, the Map Operation iterates 10 times for all nodes, including the empty nodes. As a result, 10 <record> nodes are generated in the Target.

In This Section

Additional Map Operations

See Also

© 2013 Microsoft Corporation. All rights reserved.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.