getStoredValue
The getStoredValue
function is used to retrieve a value stored using the store
function.
Syntax
c4i:getStoredValue(key [, defaultValue])
Parameters
key
The key. It is recommended to force a string key using the string function.
defaultValue (optional)
- The default value to return if there is no stored value for this key
Return value
The stored value.
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">a</ProductCrossReference>
</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"
}