Skip to main content
Previous sectionNext section

DTL <transform>

Transform an object of one type into an object of another type.

Syntax

<transform sourceClass="MyApp.SAPtoJDE" 
           targetClass="AlsoMine.JDE"  />
Copy code to clipboard

Attributes

Attribute Description Value
sourceClass Required. The class name of the input object for the data transformation. The name of a valid object and property.
targetClass Required. The class name of the output object for the data transformation. The name of a valid object and property.
sourceDocType Optional. When the input object is a virtual document, this string identifies its DocType. A string.
targetDocType Optional. When the output object is a virtual document, this string identifies its DocType. A string.
language Optional. Should be objectscript objectscript
create Optional. The create option desired for the target object. If not specified, the default is new. This can take one of the following values: new, copy, or existing as detailed in the following description.

Elements

Element Purpose
<annotation> Optional. A text string that describes the <transform> element.
Most activities Optional. <transform> may contain zero or more of the following elements in any combination: <assign>, <code>, <foreach>, <if>, <sql>, <subtransform>, or <trace>.

Description

The <transform> element is the outermost element for a DTL document. All the other DTL elements are contained within a <transform> element. Within the <transform>, the two objects have the names source and target, respectively. For example:

<transform targetClass='Demo.DTL.ExampleTarget'
           sourceClass='Demo.DTL.ExampleSource'
           create='new'
           language='objectscript'>

       <trace value='"Convert from lowercase to uppercase"'/>
       <assign property='target.UpperCase'
          value='$ZCONVERT(source.LowerCase,"U")'
          action='set'/>

</transform>
Copy code to clipboard

Source and Target Objects

The sourceClass and targetClass may identify standard production message classes, each of which contains a set of properties. If so, the sourceDocType and targetDocType attributes are not needed.

Alternatively, the sourceClass and targetClass may identify virtual documents. In this case the sourceDocType and targetDocType attributes are needed to tell InterSystems IRIS which message structure to expect in the virtual document.

Values for the create Option

The create option for the target object may have one of the following values:

  • new — Create a new object of the target type, before executing the elements within the data transformation. This is the default.

  • copy — Create a copy of the source object to use as the target object, before executing the elements within the transform.

  • existing — Use an existing object, provided by the caller of the data transformation, as the target object.