Supporting Windchill Custom Attributes
To import values from Windchill that are not being imported as part of the out-of-the-box Operator Advisor conversion process, additional configurations are required. These values can include Windchill attributes that are not already mapped to the Operator Advisor data model, or custom Windchill attributes, also known as soft attributes.
The following example imports the values of MyCustomAttribute, which is a STRING data type custom attribute on a Windchill MPMLink operation.
1. Verify that the attribute values are being returned in REST calls. Execute the following command against the Windchill MPMLink REST services, using either the MPMLink OData connector Thing (PTC.SCA.SCO.MPMLink_ODataConnector) or directly with a REST client, and verify that MyCustomAttribute is being returned:
GET /servlet/odata/MfgProcMgmt/Operations('ID')
2. Update the related <Operator_Advisor_object>_AP Data Shape. The property added to the Data Shape must be the appropriate data type for the Windchill attribute to which it is going to be mapped.
In this example, we are adding values from MyCustomAttribute to a new STRING data type property on the PTC.SCA.SCO.WorkDefinition_AP Data Shape called MyCustomProperty.
3. Verify that a column for the new property is available in the database, by executing a Get service related to the main Data Shape. In this example, execute the GetWorkDefinition service from the PTC.SCA.SCO.DefaultProductionOrderManager Thing and verify that the results include a MyCustomProperty column.
4. On the custom mappings Thing (PTC.SCA.SCO.MPMLinkWorkDefinitionCustomMappings), find and override the custom-mapping service for the Operator Advisor Data Shape and the Windchill information for which you want to map the attribute. For this example, find and override the MapWorkDefinitionPropertiesForOperationHolder service. For a list of the custom-mapping services that are provided, see Custom Mapping Services.
5. Specify the mapping between the custom property added to the <Operator_Advisor_object>_AP Data Shape and the Windchill attribute as indicated in the comments in the service code. For this example, add the following:
result["MyCustomProperty"] = sourceJson["OperationHolder"]["MyCustomAttribute"];
The sourceJson is the portion of the REST call that is provided as input for the service. Only the portion of the REST call applicable for the Windchill object type mapped by the service is provided as input for the service. For the Windchill attribute value, use the attribute name as shown in the REST call from step 1. Do not use the internal name of the attribute as it appears in Windchill.
* 
The mappings defined by Operator Advisor can also be customized using the custom-mapping services. For example, to map the Description attribute for an operation in Windchill MPMLink to the LongDescription property for work definitions in Operator Advisor, instead of to the Description property, add the following on the MapWorkDefinitionPropertiesForOperationHolderCustom service:
result["LongDescription"] = sourceJson["OperationHolder"]["Description"];
If you customize any of the mappings defined by Operator Advisor, confirm that your customized mappings are still converting as expected after upgrading to a new version of Operator Advisor.
Values for the MyCustomAttribute property on Windchill MPMLink operations are now included when process plan information is pulled from Windchill MPMLink and converted into Operator Advisor work definitions and related information.
Mapping Windchill Attributes with the Real Number with Units Data Type
Windchill attributes with the data type of Real Number with Units come through in the REST call as a JSON object with multiple values, rather than as single attribute-value pair. For example:
"Attribute2": {
"Value": 123.45,
"Unit": "m/s2",
"Precision": 5,
"Display": "123.45 m/s2"
}
You can specify a mapping for one of the values, or map the entire JSON object as the value of a STRING type property in Operator Advisor:
To map one of the attribute’s values, specify both the attribute name and the value that you want mapped:
result["MyCustomProperty"] = sourceJson["Attribute2"]["Value"]
To map the entire JSON object, including all the values, as the value for an Operator Advisor STRING type property, specify just the attribute name:
result["MyCustomProperty"] = sourceJson["Attribute2"]
Mapping Multi-Valued Windchill Attributes
A multi-valued attribute in Windchill is an attribute which has had the Single-Valued constraint removed. Only Global attributes can be multi-valued.
A multi-valued attribute from Windchill appears in the REST call with the values listed in a JSON array, similar to the following:
"MultiValuedAttribute": [
"Attribute value 1",
"Attribute value 2",
"Attribute value 3"
]
You can specify a mapping for a single value, or map the entire JSON array of attribute values as the value of a STRING type property in Operator Advisor:
To map a specific value from a multi-valued attribute, specify the attribute name and the position of the value in the order of values (starting from 0).
result["MyCustomProperty"] = sourceJson["MultiValuedAttribute"][1]
To map the entire JSON array of values for the attribute as the value for an Operator Advisor STRING type property, specify just the attribute name:
result["MyCustomProperty"] = sourceJson["MultiValuedAttribute"]
Mapping Windchill List Attributes
A list attribute in Windchill is an attribute with one of the list constraints applied: Enumerated Value List, Legal Value List, or Suggested Value List. List attributes can be either Global or Local attributes.
A list attribute from Windchill appears in the REST call as a JSON object with multiple values, rather than as single attribute-value pair. For example:
"ListAttribute": [
{
"Value": "Test 1",
"Display": "Test 1"
},
}
You can specify a mapping for one of the values, or map the entire JSON object as the value of a STRING type property in Operator Advisor:
To map one of the attribute’s values, specify both the attribute name and the value that you want mapped:
result["MyCustomProperty"] = sourceJson["ListAttribute"]["Value"]
To map the entire JSON object, including all the values, as the value for an Operator Advisor STRING type property, specify just the attribute name:
result["MyCustomProperty"] = sourceJson["ListAttribute"]
Was this helpful?