DML functions: Business Document access

getName

getClass

indexChildInstance

isFirstChildInstance

isLastChildInstance

Usage limits

Use Business Document access functions to refer to the structure of a Business Document and to extract information relating to the nodes present in the Mapping Services database. For example, you might use the indexChildInstance function to return the position of a child or leaf element node in its parent node at execution.

The following descriptions of the Business Document access functions describe the use of the expression at execution. This refers to how a Business Document structure, as defined in Mapping Services, is applied to instances of that structure during runtime server execution.

getName

getName Comment

Description

getName returns the name of a node in the input Business Document (not the value of that node).

Syntax

getName(node)

Returns

String

If the node is not present in the Business Document at execution, getName returns null. You can use getName on any type of node.

Parameter

node

Specify a node of the input Business Document.

Example

getName(this) returns "ClientTransaction", if the name of the node of the current context is ClientTransaction.

getClass

getClass Comment

Description

getClass returns the data class of an input Business Document node.

Syntax

getClass(node)

Return

String

If no data class is associated with the node, in the case of nodes without values for example, or if the node is not present at execution, getClass returns null.

Parameter

node

Specify a node of the input Business Document.

Examples

getClass(\Items\Label) returns String, when the Items node contains String data.

getClass(\Items\Price) returns Real, when the Price node belongs to the class R.

 

indexChildInstance

indexChildInstance Comment

Description

indexChildInstance returns the position of the child node in the parent node at execution.

Syntax

indexChildInstance(child_node)

Return

Integer that is greater than or equal to 1 or nullif the child node is not present at execution.

Parameter

child_node

Specify the child node.

Example

The following example shows:

  • How the Business Document ClientTransaction appears in Mapping Services
  • An example of the same Business Document at execution

The inclusion of the ALL node means that all of the child nodes must be processed, but can be processed in any order. indexChildInstance returns the position at which the child node Address occurs in the parent node at execution.

Example of Business Document tree structure as it appears in Mapping Services

 Business Document icon ClientTransaction (1-1)

Client (1-1)

Parent ALL element icon ALL (1-1)

LastName (1-1)

FirstName (1-1)

Address (1-1)

 

Results

indexChildInstance(\ClientTransaction\Client\Address) returns the value 1. At execution, Address is the first child node of the parent node Client.

If Address appears in the second position at execution, indexChildInstance returns the value 2.

 

isFirstChildInstance

isFirstChildInstance Comment

Description

isFirstChildInstance checks whether or not a child node occurs first in its parent node at execution.

Syntax

isFirstChildInstance(child_node)

Return

Boolean

If the child node is:

  • The first child of its parent node at execution, isFirstChildInstance returns true
  • Not the first child of its parent node at execution, isFirstChildInstance returns false
  • Not present at execution,isFirstChildInstance returns null

Parameter

child_node
Specify the name of the child node

Example

The following example shows:

  • How the Business Document ClientTransaction appears in Mapping Services
  • An example of the same Business Document at execution

The inclusion of the ALL node means that all of the child nodes must be present, but can be present in any order. isFirstChildInstance checks whether the specified child node is the first child node of the parent node at execution.

Example of Business Document tree structure as it appears in Mapping Services

 Business Document icon ClientTransaction (1-1)

Client (1-1)

Parent ALL element icon ALL (1-1)

LastName (1-1)

FirstName (1-1)

Address (1-1)

Results

isFirstChildInstance(\ClientTransaction\Client\LastName) returns the value true. At execution, LastName is the first child node in the parent node Client.

isFirstChildInstance(\ClientTransaction\Client\FirstName) returns the value false. At execution, FirstName is not the first child node in the parent node Client.

 

isLastChildInstance

isLastChildInstance Comment

Description

isLastChildInstance checks whether or not a child node occurs last in its parent node at execution.

Syntax

isLastChildInstance(child_node)

Return

Boolean

If the child node is:

  • The last child in its parent node at execution, isLastChildInstance returns true
  • Not the last child in its parent node at execution, isLastChildInstance returns false
  • Not present at execution, isLastChildInstance returns null

Parameter

child_node
Specify the name of the child node

Example

The following example shows:

  • How the Business Document ClientTransaction appears in Mapping Services
  • An example of the same Business Document at execution

The inclusion of the ALL node means that all of the child nodes must be present, but can be present in any order. isLastChildInstance checks whether the specified child node is the last child node in the parent node at execution.

Example of a Business Document tree structure as it appears in Mapping Services

Business Document icon ClientTransaction (1-1)

Client (1-1)

Parent ALL element icon ALL (1-1)

LastName (1-1)

FirstName (1-1)

Address (1-1)

Results

isLastChildInstance(\ClientTransaction\Client\Address returns the value true. At execution, Address is the last child node in the parent node Client.

isLastChildInstance(\ClientTransaction\Client\LastName) returns the value false. At execution, LastName is not the last child node in the parent node Client.

Usage limits

You can use the Business Document access functions in the following DML expressions:

  • Validation Rule
  • Identification with Business Document
  • Map (not on a trigger)
  • Decision path (not on a trigger)

Related Links