CompanionCompanion
Companion for Delivery
Companion for Business
Companion for Integration
Contact us
Companion for Delivery
Companion for Business
Companion for Integration
Contact us
  • Companion for Integration

    • Introduction
    • Getting Started
    • Configuration
    • Excel templating
    • How it works
  • YAML Configuration

    • Principles
    • Syntax
    • Validation
  • Custom Functions

    • Summary
    • arrayToJSON
    • bool
    • concatValueAndUnit
    • convertUnit
    • currentContextId
    • exportTime
    • eval
    • firstNonEmpty
    • getContextName
    • getEvents
    • getLastEventTime
    • getReferencesByAttributeGroup
    • getStoredValue
    • getWorkspaceId
    • hash
    • hasStoreKey
    • if
    • integer
    • join
    • mergeInheritedValues
    • multiValuesToJSON
    • number
    • nodeList
    • order
    • resolveUnitLabel
    • serializeAssetPushLocationsToJSON
    • serializeAttributeLinksToJSON
    • serializeContextReferenceToJSON
    • serializeContextReferencesToJSON
    • serializeContextValuesToJSON
    • serializeDataContainerToJSON
    • serializeDataContainersToJSON
    • serializeListOfValueValuesToJSON
    • serializeReferencesToJSON
    • serializeReferenceToJSON
    • serializeValuesToJSON
    • store
    • toXML
    • uppercase
  • Execution

    • Summary
    • Composite
    • From STEP
    • Standalone
    • Performance statistics
  • Configuration

    • ActiveMQ extension
    • Amazon AWS extension (SNS, SQS, Kinesis, S3)
    • ElasticSearch/OpenSearch extension
    • File extension (Excel, CSV, JSON, XML, JSONL, XMLL)
    • Kafka extension
    • Kafka Core extension
    • MongoDB/Cosmos DB extension
    • SQL extension
    • REST extension
    • Google Pub/Sub extension
  • c4i SaaS

    • Introduction
    • Managing jobs
    • Managing executions
    • Managing users
    • Changelog
  • Changelog

    • Core features changelog
    • ActiveMQ extension changelog
    • Amazon AWS extension changelog
    • Composite extension changelog
    • ElasticSearch extension changelog
    • File extension changelog
    • Kafka extension changelog
    • Kafka Core extension changelog
    • MongoDB/Cosmos DB extension changelog
    • SQL extension changelog
    • REST extension changelog
    • Google Pub/Sub extension changelog

YAML configuration syntax

This is the general form of a Companion for integration YAML configuration file :

- RootXpath1:
    destName1[id1]:
        - xPathMapping1 : id1
        - xPathMapping2 : column2
        - xPathMapping3 : column3

- RootXpath2:
      destName2[id2]:
        - xPathMapping4 : id2
        - xPathMapping5 : column5
        - xPathMapping6 : column6

Each top level entry is a XPath to the elements in the STEP XML that should be sent to the destination. For each matching element in the XML, one message will be sent to the destination

The following line is the destination name followed by the list of ID columns between brackets, separated by commas. According to the output type, the destination name can represent a table, a collection, a topic, a file, ...

Then, indicate the list of mappings to populate the output message. Each line consists of a XPath to be applied on the root element and the target name, separated by a colon. According to the output type, the target name can represent a column in a table, a key in a JSON document, ... Companion for integration provides a variety of custom functions to efficiently expose STEP data using JSON.

The following sections give few examples of YAML configuration for the different kind of STEP data.

Products

- Product[@UserTypeID=...]:
    products[id]: # table name[primary key]
        - ./@ID: id
        - Name/text(): name
        - Values/Value[@AttributeID="..."]/text(): attribute
        - AssetCrossReference[@Type="..."][1]/@AssetID: primaryimage

Classifications

- Classification[@UserTypeID=...]:
    classifications[id]: # table name[primary key]
        - ./@ID: id
        - Name/text(): name
        - MetaData/Value[@AttributeID="..."]/text(): attribute

Assets

- Asset[@UserTypeID=...]:
    assets[id]: # table name[primary key]
        - ./@ID: id
        - Name/text(): name
        - Values/Value[@AttributeID="..."]/text(): attribute

Entities

- Entity[@UserTypeID=...]:
    entities[id]: # table name[primary key]
        - ./@ID: id
        - Name/text(): name
        - Values/Value[@AttributeID="..."]/text(): attribute

Attributes

- Attribute:
    attributes[id]: # table name[primary key]
        - ./@ID: id
        - Name/text(): name
        - Validation/:
            - ./@BaseType: validation.type
            - ./@MinValue: validation.min
            - ./@MaxValue: validation.max
            - ./@MaxLength: validation.length
            - ./@InputMask: validation.mask
        - ListOfValueLink/@ListOfValueID: listofvalue
        - DimensionLink[1]/@DimensionID: dim1
        - DimensionLink[2]/@DimensionID: dim2

List Of Values

- ListOfValue:
    listsofvalues[id]: # table name[primary key]
        - ./@ID: id
        - Name/text(): name
        - Validation/:
              - ./@BaseType: validation.type
              - ./@MinValue: validation.min
              - ./@MaxValue: validation.max
              - ./@MaxLength: validation.length
              - ./@InputMask: validation.mask
        - DimensionLink[1]/@DimensionID: dim1
        - DimensionLink[2]/@DimensionID: dim2

Deletion messages

For some connectors there is no way to handle suppressions (ie: ActiveMQ), then it is possible to generate deletion messages by adding the following lines to the yaml file:

- DeletedProducts:
    deletedProduct[id]:    
        - ./@ID: id
- DeletedClassifications:
    deletedProduct[id]:    
        - ./@ID: id
- DeletedAssets:
    deletedAsset[id]:    
        - ./@ID: id
- DeletedEntities:
    deletedEntity[id]:    
        - ./@ID: id

You also need to add the following lines in the OIEP in case you use Advanced StepXML format:

<DeleteProducts></DeleteProducts>
<DeleteAssets></DeleteAssets>
<DeleteClassifications></DeleteClassifications>
<DeleteEntities></DeleteEntities>

Ignored output

If a destination name starts with a dot, then Companion for integration will handle the entry but no message will be sent to the destination.

It can be useful to store intermediary data using the store custom function, or to temporarily disable a destination.

Last Updated: 7/31/23, 10:35 AM
Prev
Principles
Next
Validation