store

The store function is used to store a key-value pair in memory, to be used later with the getStoredValue function.

Syntax

c4i:store(key, value [, order])

Parameters

key

The key. It is recommended to force a string key using the stringopen in new window function.

value

The value to store. It can be a simple value (string, number, ...) or a JSON structure

order (optional)

The order to execute the function. If not specified, it will be 1. All other operations (excluding other store functions) will be executed later.

Return value

The value. If you do not wish to see this value in the output message, use the dot notation in the destination name to ignore the output.

Example

Given the following STEP XML :

<STEP-ProductInformation>
    <Products>
        <Product ID="PRD1">
            <Name>Some product</Name>
        </Product>
        <Product ID="PRD2">
            <ProductCrossReference Type="Replacement" ProductID="PRD1"/>
        </Product>
    </Products>
</STEP-ProductInformation>

The following YAML configuration will produce the following output :

- Product:
    .product[_id]:
      - ./@ID: _id
      - c4i:store(string(./@ID), Name/text()): name

- Product:
    product[_id]:
      - ./@ID: _id
      - c4i:getStoredValue(string(ProductCrossReference[@Type="Replacement"][1]/@ProductID)): replacement_name
{
    "_id" : "PRD2",
    "replacement_name" : "Some product"
}
Last Updated: