Object and Element functions

About Object and Element functions

You use Object and Element functions in Transform rules to create Objects and Elements from imported records when importing a file. The input record structure is defined via a Datasource. Depending on the data in the currently processed record, rules can create one or several Objects and/or Elements.

newObject(identifier)

Description

Creates a new Business Object that can be assigned to a variable in order to set its properties. The created Business Object is automatically filled with business properties. The values of the business properties are taken from the current line according to the Datasource that is being used.

Restriction: It can be used only in transform rules.

Syntax newObject(identifier)
Return

Object

Parameters identifier: Identifier given for the Object.
Example

If ds.DIRECTION=’D’

Then myObj = newObject(“”);

myObj.PROP1 = ds.ATT1;

myObj.PROP2 = "CPT" ;

myObj.PROP3 = compute(ds.ATT2) ;

getObject(identifier)

Description

Returns:

  • The last created Object that was identified by the given identifier in the import session.
  • Null if no Object was found.

Restriction: It can be used only in transform rules.

Syntax getObject(identifier)
Return

Object

Parameters identifier: Identifier of the created Object.
Example

Definition

myObj = getObject(“1”);

If myObj is not null

Then myObj.PROP1 = ds.ATT2 ;

newElement(identifier, parent)

Description

Creates a new Element. It can be assigned to a variable in order to set its properties. The created Element is automatically filled with business properties. The values of the business properties are taken from the current line according to the Datasource that is being used.

Restriction: It can be used only in transform rules.

Syntax newElement(identifier, parent)
Return

Element

Parameters

identifier: Identifier of the created Element.

parent: Parent of the created Element (an Object or another Element).

Example

Definition myObj = getObject("1") ;

if ds.DIRECTION=”C”

then elt1= newElement(“1”, myObj);

elt1.PROP1 = ds.ATT1;

else elt2 = newElement("2", myObj) ;

elt1.PROP1 = ds.ATT2;

getElement(identifier)

Description

Returns a previously created Element with the specified identifier.

Restriction: It can be used only in transform rules.

Syntax getElement(identifier)
Return

Element

Parameters identifier: Identifier of a previously created Element.
Example

Definition

myElt = getElement("1") ;

if ds.CATEGORY=”A”

then elt1= newElement(“1”, myElt);

Related Links