Skip to main content

DTL <code>

Execute lines of custom code.

Syntax

<code>
   <![CDATA[ target.Name = source.FirstName & " " & source.LastName]]> 
</code>

Elements

Element Purpose
<annotation> Optional. A text string that describes the <code> element.

Description

The DTL <code> element executes one or more lines of user-written code within a DTL data transformation. You can use the <code> element to perform special tasks that are difficult to express using the DTL elements. Any properties referenced by the <code> element must be properties within the source or target object for the data transformation.

The scripting language for a DTL <code> element is specified by the language attribute of the containing <transform> element. The value should be objectscript. Any expressions found in the data transformation, as well as lines of code within <code> elements, must use the specified language.

For further information, see the following items:

Typically a developer wraps the contents of a <code> element within a CDATA block to avoid having to worry about escaping special XML characters such as the apostrophe (') or the ampersand (&) . For example:

<code>
  <![CDATA[ target.Name = source.FirstName & " " & source.LastName]]>
</code>

In order to ensure that execution of a data transformation can be suspended and restored, you should follow these guidelines when using the <code> element:

  • The execution time should be short; custom code should not tie up the general execution of the data transformation.

  • Do not allocate any system resources (such as taking out locks or opening devices) without releasing them within the same <code> element.

  • If a <code> element starts a transaction, make sure that the same <code> element ends the transactions in all possible scenarios; otherwise, the transaction can be left open indefinitely. This could prevent other processing or can cause significant downtime.

Available Variables

The variables that are available in a DTL <code> element are dependent upon the method used to call the element. Refer to the following table to see the available variables and their properties:

Variable Name Purpose Available when DTL is called through:
source Contains properties of the source message. All methods
target Contains properties of the target message. All methods
process The process object represents the current instance of the BPL business process object (an instance of the BPL class). This object has one property for each property defined in that class. You can invoke methods of the process object; for example: process.SendRequestSync() BPL business processes
context The context object is a general-purpose data container for the business process. context has no automatic definition. To define properties of this object, use the <context> element. That done, you may refer to these properties anywhere inside the <process> element using dot syntax, as in: context.Balance BPL business processes
aux Contains information from the business rule that called the DTL. Business rules
FeedbackOpens in a new tab