Transformation Template
Templates are valid JSON documents with special keys and fields used to describe how the template should be applied to the underlying data.
Example Template
{
"address": "$mapping(address, $(First(\"Locations_List\", \"Address\")))",
"vendors": [
{
"#each": "$(<ERP_Record>)",
"#if": "$(<Ready_To_Transact> <> \"n\")",
"#inline": "$mapping(vendor)",
"bank": "$mapping(banking)",
}
],
"contacts": [
{
"#inline": "$mapping(payment_contact)"
},
{
"#inline": "$mapping(ordering_contact)"
},
{
"#inline": "$mapping(support_contact)"
},
{
"#inline": "$mapping(sales_contact)"
}
],
}
Template Operations
Operation | Type | Description |
---|---|---|
$mapping(name[, context]) | Special Value | Apply the mapping to the fields in the current context. Optionally, include a Graphite Expression as a 2nd parameter to specify the context. Mappings are defined and named in the Transformation Mapping sheet. The default context is the full profile, or the root of the JSON document. When in an #each loop, the default context is the current instance of the loop. |
$(expression) | Special Value | A graphite expression. The result of which will be used as that field’s value. |
# each | Special Key Name | Used to apply a template, the sibling keys in the current object, to an array of objects. The value of the #each key must be a Graphite Expression returning a multiple group. |
# if | Special Key Name | Can be used in any object. The value of the #if key must be a Boolean Graphite Expression. If the expression evaluates to false, the object will not be included in the output. |
# inline | Special Key Name | Can be used in any object. The value of the #inline key must be a $mapping operation. The results of the mapping will be inlined in the current object, all the resulting fields will be copied as siblings of the #inline key field. |
# flatten | Special Key Name | |
# hideArrayIf | Special Key Name | |
$item | Special Value | |
$instances | Special Value | |
$indexes | Special Value |
Updated 7 months ago