Create objects and relate them

This example pipeline demonstrates how to create two objects and then relate them to each other.


Pipeline containing seven Snaps.

Steps

1: First Snap is a JSON Generator Snap “Create input” which stores the following JSON file. The content of the JSON is one property “name” and a list property “expandAttributes”. Both will be used in Tc Create Snaps.

Snap configuration

Snap output


Settings tab of JSON Generator Snap.

[
  {
    "name": "Clutch",
    "expandAttributes": [
		"object_type",
		"object_name",
		"object_string",
		"object_desc",
		"item_id",
		"item_revision_id",
		"uom_tag",
		"creation_date",
		"fnd0IcsClassNames",
		"is_modifiable",
		"ics_classified",
		"owning_user",
		"fnd0CurrentLocationCode",
		"checked_out"
	]
  }
]

2: Next Snap is the Copy Snap “Copy Name” since two objects shall be created.

Snap configuration

Snap output


Settings tab of Copy Snap.

3: One JSON document goes to Tc Create Snap “Tc Part Create” that is configured to create a Part. Object Type is hard coded to Part and the JSON property “name” is value of attribute “object_name”.

Snap configuration

Snap output


Settings tab of Tc Create Snap. Object Type is set to 'Part and name information stored in JSON is value for attribute 'object_name'.

4: The other JSON document copy is input for Tc Create Snap “Tc Document Create” which is configured to create a document. Object Type is hard coded to Document and the JSON property “name” is Value of attribute “object_name”.

Snap configuration

Snap output


Settings tab of Tc Create Snap. Object Type is set to 'Document and name information stored in JSON is value for attribute 'object_name'.

5: Outputs of both creations are collected by a Gate Snap “Gate part and document”. Views tab shows naming input views which lead to naming of JSON list objects in output document of the Gate Snap.

Snap configuration

Snap output


Settings tab of Gate Snap. All input documents shall be content of output document.


JSON output document of gate Snap.


Views tab of Gate Snap.

The output JSON contains now information of part and document.

6: Next the Mapper Snap “Extract UIDs of part and document” selects and maps data necessary for further steps. UID of created document and part object is mapped to DocumentRevisionUID respectivly partRevisionUID.

Snap configuration

Snap output


Mapper Snap Settings tab where Mapping table contains two rows. UID propterty of JSON input documents are mapped to target path.


JSON document including property 'documentRevisionUID' and 'partRevisionUID'.

Output JSON document contains now only id information.

Note:

UIDs in Teamcenter are as the name says UNIQUE. The UIDs in the example only exist in our Teamcenter system as expected for our example. Same is valid for Adapter ID "_id" since its base is the UID.

7: Teamcenter relations are created between two objects using their UID to identify them. The Tc Relation Create Snap “Tc DescribedBy Relation Create” has a field called “Primary ID” to fill in the UID of one object which shall be the primary object of the relation. And the field “Secondary ID” contains then the UID of the other object. Technical name of the relation is stored in field “Relation”. To relate part and document the relation DescribedBy is choosen.

Snap configuration

Snap output


Create objects and relate them


Outpu JSON document of Tc Relation Create Snap.

The output in case no “Expand Attributes” are configured consists only of ID information for the created relation object.

Result is visible in Teamcenter then by searching part and check attachments.