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

concatValueAndUnit

The concatValueAndUnit function is used to display a single attribute value and unit.

Syntax

c4i:concatValueAndUnit(xpath [, units])

Parameters

xpath

XPath to an attribute value

units (optional)

  • Indicates how to represent units
  • The authorized values are "DISPLAY_UNIT_LABEL" (default) and "DISPLAY_UNIT_ID",

Return value

A string

Example

Given the following STEP XML:

<STEP-ProductInformation>
    <UnitList>
        <Unit ID="unece.unit.KTM">
            <Name>km</Name>
        </Unit>
    </UnitList>
    <AttributeList>
        <Attribute ID="ATT2">
            <Validation BaseType="number">
                <UnitLink UnitID="unece.unit.KTM"/>
            </Validation>
        </Attribute>
    </AttributeList>
    <Products>
        <Product ID="PRD1">
            <Values>
                <Value AttributeID="ATT2" UnitID="unece.unit.KTM">16</Value>
            </Values>
        </Product>
    </Products>
</STEP-ProductInformation>

The following YAML configurations will produce the following output

YAML ConfigurationJSON output
c4i:concatValueAndUnit(Values/Value[@AttributeID="ATT2"], "DISPLAY_UNIT_LABEL")"16 km"
c4i:concatValueAndUnit(Values/Value[@AttributeID="ATT2"], "DISPLAY_UNIT_ID")"16 unece.unit.KTM"
Last Updated: 8/4/23, 1:12 PM
Prev
bool
Next
convertUnit