File extension

Summary

This extension generates files in one of the following formats: Excel, CSV, JSON, XML.

Plugin ID

The plugin ID for File delivery is fr.cantor.c4i.FileDelivery.

Properties

Property keyDescriptionMandatoryDefault value
debugtrue to display debug logNofalse
outputDirectoryThe path of the directory where the output files will be writtenYes
csvSeparatorThe CSV separator used to separate valuesOnly if outputFormat = CSV
configAssetIdThe ID of the asset containing the YAML mappingsYes
templateFolderPathThe path of the directory where the Excel template are in standalone mode onlyNo
prefixFileNamesWithContextIdtrue or false to indicate whether or not to prefix the file names with the context IDsYes
deleteElementsNotMatchingFilterstrue or false to indicate if elements not matching filters should be written in the deletion fileYes
outputFormatCSV, EXCEL, JSON, JSONL or XMLYes
suffixDestinationNamesWithStepXMLTimestamptrue or false to indicate if output file name should be suffixed with the timestamp from STEP exported file name or with the timestamp contained in the "ExportTime" attribute inside the STEPXMLYes
includeEmptyTabstrue or false to indicate whether or not to include empty tabs when using Excel templatesYes
templateExtensionsA semicolon (;) separated list of extensions to resolve template filesNo.xlsx
cacheConfigThe ID of the asset containing the JCS configurationNo

Configuration example

extensions.[0].pluginId=fr.cantor.c4i.FileDelivery
extensions.[0].outputDirectory=/workarea/oiep/c4i-csv/
extensions.[0].csvSeparator=;
extensions.[0].configAssetId=C4I-Configuration
extensions.[0].prefixFileNamesWithContextId=true
extensions.[0].deleteElementsNotMatchingFilters=false
extensions.[0].outputFormat=CSV
extensions.[0].suffixDestinationNamesWithStepXMLTimestamp=false
extensions.[0].includeEmptyTabs=false
pluginId=fr.cantor.c4i.FileDelivery
outputDirectory=/workarea/oiep/c4i-csv/
csvSeparator=;
configAssetId=/Path/to/C4I/Configuration.yml
prefixFileNamesWithContextId=true
deleteElementsNotMatchingFilters=false
outputFormat=CSV
licenseAssetId=/Path/to/C4I/License.cat
suffixDestinationNamesWithStepXMLTimestamp=false
includeEmptyTabs=false
cacheConfig=/Path/to/JCS/Config.ccf
extensions.[0].pluginId=fr.cantor.c4i.FileDelivery
extensions.[0].outputDirectory=/workarea/oiep/c4i-excel/
extensions.[0].templateFolderPath=/Path/to/Excel/Template/Folder
extensions.[0].configAssetId=C4I-Configuration
extensions.[0].prefixFileNamesWithContextId=true
extensions.[0].deleteElementsNotMatchingFilters=false
extensions.[0].suffixDestinationNamesWithStepXMLTimestamp=false
extensions.[0].outputFormat=EXCEL
extensions.[0].includeEmptyTabs=true
pluginId=fr.cantor.c4i.FileDelivery
outputDirectory=/workarea/oiep/c4i-excel/
templateFolderPath=/Path/to/Excel/Template/Folder
configAssetId=/Path/to/C4I/Configuration.yml
prefixFileNamesWithContextId=true
deleteElementsNotMatchingFilters=false
outputFormat=EXCEL
licenseAssetId=/Path/to/C4I/License.cat
suffixDestinationNamesWithStepXMLTimestamp=false
includeEmptyTabs=true
cacheConfig=/Path/to/JCS/Config.ccf

JSON specificities

When producing JSON files, there are two formats for target node mapping :

  • Simple (Array) : ${fileName}[{key}]
  • Complex (Object): ${fileName}://{target node path}[{key}]

Simple (Array) Mapping

Using this format will produce a JSON file containing an array whose elements will be the mapped nodes.

For example, given the following configuration:

- Product:
  product[id]:
    - ./@ID: id

The resulting file will contain a single JSON array. For each <Product> in the source file, a new object will be inserted.

[
  { "id": "Product1" },
  { "id": "Product2" }
]

Complex (Object) Mapping

Using this format will produce a JSON file containing a JSON Object whose values (or sub-values) will be JSON arrays containing the mapped nodes.

For example, given the following configuration:

- Product:
  product://data.products[id]:
    - ./@ID: id

The resulting file will contain a single JSON Object. For each <Product> in the source file, a new object will be inserted in the "data.products" array.

{
  "data": {
    "products": [
      { "id": "Product1" },
      { "id": "Product2" }
    ]
  }
}

Arrays indices are not supported in the supplied path.

XML specificities

Target node mapping

When producing XML files, the format for target node mapping is the following : {fileName}://{target node xPath}[{key}]

For example, given the following configuration :

- Product:
  product://MyCustomProducts/Product[./@ID]:
    - ...

For each <Product> in the source file, a new <Product> element will be created underneath the root node <MyCustomProducts> in the output XML file [{contextId}]_product.xml.

The root node (in this case MyCustomProducts) must be the same across all the mapping rules for a given output file. Otherwise, a DOMException will be thrown when generating the file.

Converting JSON values to XML

JSON values such as returned by C4i custom functions are converted to XML, as shown by the following example :

<STEP-ProductInformation>
    <Products>
        <Product ID="PRD1">
        <Name>Test Product</Name>
        <Values>
            <Value AttributeID="ATT_1">Example value</Value>
        </Values>
    </Product>
</Products>
</STEP-ProductInformation>
- Product:
    products://Products/Product[./@ID]:
        - ./@ID: ./@ID
        - Name/text(): Name
        - c4i:serializeValuesToJSON(Values): Values
<Products>
    <Product ID="PRD1">
        <Name>Test Product</Name>
        <Values>
            <ATT_1>Example Value</ATT_1>
        </Values>
    </Product>
</Products>
Last Updated: