Attribute Values
Summary
Attribute Values are generic reference data held within SyncHive. These are for modelling reference data that don't have an explicit model in SyncHive. As Attribute Values are separate documents, these documents may also hold external identities for mappings.
Attribute Fields are a key to zero-to-many mapping, used for referencing attribute values.
Instead of nested AttributeValue structures there are flattened fields directly on the entity. Each attribute becomes a set of resolved fields, such as:
attribute_code
attribute_description
If an attribute can contain multiple values (e.g., multiple tags), the corresponding fields become arrays:
attribute_externalId[]
Data Definitions
AttributeField
| Data Type | Field Name | Description |
|---|---|---|
| AttributeValue | attributeValue | The attribute values to reference. |
| string | key | The key for this mapping. |
AttributeValue
| Data Type | Field Name | Description |
|---|---|---|
| string | code | A code to reference the attribute value by. Forms an alternate key with the discriminant. |
| string | description | A description of the attribute value. |
| string | discriminant | A discriminant to categorize/group attribute values. Forms an alternate key with the discriminant. |
Sample JSON
Product Example
Say we want to store the possible Product colors as reference data in SyncHive; Attribute Values can be a suitable candidate for holding such data. We would first setup the possible colors as a AttributeValue. The discriminant could be set as ProductColor to distinguish the type of attribute value, and codes would hold a unique value for each ProductColor.
[
{
"hiveId": "EDEA6B9C28BD",
"discriminant": "ProductColor",
"code": "RED",
"description": "Red"
},
{
"hiveId": "A19F7C44D2EF",
"discriminant": "ProductColor",
"code": "BLUE",
"description": "Blue",
"ext_jbaCode": "FQ"
}
]
Once an AttributeValue is created, you can reference it using any supported identifier, such as a hiveId or externalId. The key used in an AttributeField is simply the logical name of the attribute on the entity and does not need to correspond to the AttributeValue’s discriminant.
Referencing AttributeValue by hiveId:
{
"@type": "Product",
"attributeField": [
{
"@type": "AttributeField",
"key": "color",
"attributeValue": [
{
"@type": "DataReference",
"schemaName": "limber",
"shapeName": "AttributeValue",
"hiveId": "AF12BC9D0032"
}
]
}
]
}
Referencing AttributeValue by externalId:
{
"@type": "Product",
"attributeField": [
{
"@type": "AttributeField",
"key": "color",
"attributeValue": [
{
"@type": "DataReference",
"schemaName": "limber",
"shapeName": "AttributeValue",
"externalId": {
"system": "WMS",
"id": "FQ"
}
}
]
}
]
}