Loading Size Range Templates¶
If you have not reviewed the Getting Started page, please do so to understand the fundamentals of loading data.
Size Range Template
is an entity type that stores Size Range
data that can be referenced and re-used by another entity type.
If a T-Shirt comes in a Size Range
of "Small", "Medium", and "Large", a Size Range Template
will store these sizes on its sizeRange
property.
This Size Range
can have one or two dimensions. The T-Shirt example is a one-dimensional Size Range
, but footwear
might in sizes with different widths, like "7D", "8D", "9D", and also "7E", "8E", "9E". This is a two-dimensional Size Range
.
Tying this together with other entity types, if a T-Shirt and its different colors are modeled as Item
entities,
the Item
entity can reference the Size Range Template
and specify which sizes within its Size Range
are applicable to that Item
.
This is done by configuring the Item
to have a sizeRange
of type Size Range
and by specifying sizeRangeTemplate
as an object reference
to the Size Range Template
entity type. The Size Range Template
itself must also have a sizeRange
property of type Size Range
.
With this configuration, you can set a Size Range
on an Item
from the Size Range Template
's defined sizeRange
.
Loading One-Dimensional Size Ranges¶
sizeRange
API Representation¶
A Size Range Template
with a one-dimensional sizeRange
will have one array property sizes
with a flat structure.
{
"sizeRange": {
"sizes": [
"Small",
"Medium",
"Large"
]
},
"typePath": "size-range-template",
"federatedId": "1d-t-shirt-sizes",
"name": "T-Shirt Sizes",
"id": "0-kuTOyJbAOH9Wxq",
"entityType": "size-range-template"
}
Load Example¶
CSV Data File¶
In raw CSV form, sizeRange
rows should be comma-separated strings wrapped in double quotes. This escapes the commas
while maintaining an array structure in a single CSV row/column.
federatedId,name,sizeRange
1d-test-load-size,T-Shirt Sizes,"Small,Medium,Large"
federatedId | name | sizeRange |
---|---|---|
1d-test-load-size | T-Shirt Sizes | Small,Medium,Large |
Config YAML / JSON¶
Please review the Creating a Loader Process to understand how to provide this Config example to the Loader.
loadType:
- SIZE_RANGE_TEMPLATE
federatedMappings:
federatedId: "federatedId"
{
"loadType": [
"CUSTOM_ENTITY"
],
"federatedMappings": {
"federatedId": "federatedId"
},
}
Loading Two-Dimensional Size Ranges¶
sizeRange
API Representation¶
A Size Range Template
with a two-dimensional sizeRange
will have one object property sizes
with property keys as
the first dimension and array values as the second dimension.
{
"sizeRange": {
"sizes": {
"D": ["8", "9", "10", "11", "12", "13", "14"],
"E": ["11", "12", "13", "14"],
"EE": ["13", "14"]
}
},
"typePath": "size-range-template",
"federatedId": "2d-footwear-sizes",
"name": "Footwear Size Range",
"typeId": "v3Ab2EdplxY1_7F-",
"id": "WL5J_Mt_hMYSb4d4",
"entityType": "size-range-template"
}
Load Example¶
CSV Data File¶
In raw CSV form, sizeRange
rows should be comma-separated strings wrapped in double quotes. This escapes the commas
while maintaining an array structure in a single CSV row/column. The first dimension is separated by a colon and the second dimension is separated by commas.
Specify the first dimension name before the colon and its second-dimension list after it.
federatedId,name,sizeRange
2d-footwear-sizes,Footwear Size Range,"D:8,9,10,11,12,13,14,E:11,12,13,14,EE:13,14"
federatedId | name | sizeRange |
---|---|---|
1d-test-load-size | T-Shirt Sizes | D:8,9,10,11,12,13,14,E:11,12,13,14,EE:13,14 |
Config YAML / JSON¶
Please review the Creating a Loader Process to understand how to provide this Config example to the Loader.
loadType:
- SIZE_RANGE_TEMPLATE
federatedMappings:
federatedId: "federatedId"
{
"loadType": [
"CUSTOM_ENTITY"
],
"federatedMappings": {
"federatedId": "federatedId"
},
}