Converting delimited data to business objects
This section provides the following information on how
the Delimited data handler converts Delimited data to business objects:
Delimited string requirements
When converting a string or stream, the Delimited data
handler makes the following assumptions:
- The data contains the delimiter specified in the Delimiter meta-object attribute.
- The business object name appears in the first field in the data.
- The verb appears as the second field in the data.
- Attributes are in the order that they appear in the business
object definition.
- All objects in a child container are of the same type.
- The data contains a token that represents the number of child
objects in each cardinality n container.
- The ObjectEventId attribute is present in each business object. An entry for ObjectEventId is always required for a business object, even when it has
the value CxIgnore, because the data handler uses it to distinguish between
instances of a business object at run time.
If you have more than one business object in the data, make sure
you do not introduce any new characters (such as a space, a tab,
a new line, or a carriage return) between them.
When the Delimited data handler reads a file in Delimited format,
it takes the following special processing steps to
assign to a business object attribute the CxIgnore or CxBlank attribute value:
- It assigns the CxIgnore constant (null) as the corresponding attribute value whenever it encounters
any of the following conditions in the Delimited data:
- The value of the CxIgnore meta-object attribute (the value configured for its Default
Value property)
- The value of an empty string (" ")
- It assigns the CxBlank constant as the attribute value only when the CxBlank meta-object attribute is configured and it encounters this
configured value in the corresponding Delimited data.
Note:
Make sure the
escape
string and the delimiter have different values as configured by the
Escape and
Delimiter meta-object attributes in the Delimiter data handler child
meta-object.
The
following line shows an example of a string in Delimited format.
The syntax is:
Bus_Obj_Name<delimiter>Verb<delimiter>Attr1<delimiter>Attr2<delimiter>
Number_of_child_object_instances<delimiter>Child_Object_Name<delimiter>
Verb<delimiter>Attr1<delimiter>Attr2<EndBO:Bus_Obj_Name>
The following sample uses a tilde (~) delimiter:
Customer~Create~p1~p2~p3~1~CustomerAddress~Create~q1~q2~q3~q4~q5~q6~q7~q8~q9~q10~3~
PhoneInfo~Create~r1~r2~r3~r4~r5~r6~r7~PhoneInfo~Create~r1~r2~r3~r4~r5~r6~r7~
PhoneInfo~Create~r1~r2~r3~r4~r5~r6~r7
Serialized-data processing
The Delimited data handler processes delimited data into
a business object as follows:
- The data handler gets the business object name from the first
token in the data and creates a business object to contain the data.
- The data handler sets the verb in the business object. The data
handler assumes that the verb for the top-level business object
is in the second token in the delimited data. Note that child business
objects may not have verbs set.
- The data handler determines if there are any child meta-objects
(those whose names are listed in the cw_mo_ tag of the business object application-specific information).
The data handler does not perform the processing
to populate these attributes of the business object. For more information
about the cw_mo_ tag, see Implementing conversion from a business object.
- The data handler looks for meta-object attribute named OmitObjectEventId. If this is set to true, the data handler does not perform the processing to populate
the ObjectEventId attribute.
- The data handler parses the data and populates the values of
the remaining simple attributes in the business object with the
token values from the data. The data handler processes container
attributes as follows:
- If the attribute is single-cardinality, the data handler recursively
parses the attribute tokens in the string, sets the attribute values
in the business object, and adds the child business object container
to the parent business object.
- If the attribute is multiple cardinality, the data handler recursively
parses the attribute tokens for each child object, sets the attribute
values in the child business object, and adds the child business object
container to the parent business object.
