Step 7: Add the THC result¶
This is what the superpackage was for. The package carries its own lab results, so the label can print them.
- Add a
Textelement. - Set X Start to
5%, X End to95%. - Set Y Start to
65%, Y End to73%. - Set Value template to
{{ package.metadata.indexedLabResults.totalTHC.full }}. - Set Font to
Helvetica-Boldand Font size to10.
Each label now shows its own potency.
Lab results arrive as a long list with inconsistent naming, so T3 indexes them for you under
metadata.indexedLabResults, keyed by a camelCase form of the test name.Total THCbecomestotalTHC,Delta 9 THCbecomesdelta9THC. Use the autocomplete rather than guessing: it lists the keys your loaded data actually has.Each entry gives you four ways to use it:
.fullis the ready made string,Total THC: 18.2 %.nameisTotal THC.valueis the number18.2.unitis%Use
.fullwhen you want the whole thing, and.valuewhen you are building your own formatting, as we do next.
Behind the scenes
{
"name": "Tutorial label",
"labelContentLayoutElements": [
{
"name": "Tag barcode",
"elementType": "CODE128_BARCODE",
"xStartFraction": 0.05,
"xEndFraction": 0.95,
"yStartFraction": 0.46,
"yEndFraction": 0.66,
"valueTemplate": "{{ package.label }}"
},
{
"name": "Tag number",
"elementType": "TEXT",
"xStartFraction": 0.05,
"xEndFraction": 0.95,
"yStartFraction": 0.38,
"yEndFraction": 0.45,
"valueTemplate": "{{ package.label | boldEndingDigits }}",
"paragraphFontName": "Helvetica",
"paragraphFontSize": 7,
"paragraphSpacing": 8,
"horizontalParagraphAlignment": "CENTER",
"paragraphTextResizeStrategy": "SHRINK_TEXT"
},
{
"name": "Logo",
"elementType": "IMAGE",
"xStartFraction": 0.25,
"xEndFraction": 0.75,
"yStartFraction": 0.84,
"yEndFraction": 0.98,
"valueTemplate": "{{ images['logo.png'] }}"
},
{
"name": "Product name",
"elementType": "TEXT",
"xStartFraction": 0.05,
"xEndFraction": 0.95,
"yStartFraction": 0.69,
"yEndFraction": 0.81,
"valueTemplate": "{{ package.item.name }}",
"paragraphFontName": "Helvetica-Bold",
"paragraphFontSize": 11,
"paragraphSpacing": 12,
"horizontalParagraphAlignment": "CENTER",
"paragraphTextResizeStrategy": "SHRINK_TEXT"
},
{
"name": "Potency",
"elementType": "TEXT",
"xStartFraction": 0.05,
"xEndFraction": 0.95,
"yStartFraction": 0.27,
"yEndFraction": 0.35,
"valueTemplate": "{{ package.metadata.indexedLabResults.totalTHC.full }}",
"paragraphFontName": "Helvetica-Bold",
"paragraphFontSize": 10,
"paragraphSpacing": 11,
"horizontalParagraphAlignment": "CENTER",
"paragraphTextResizeStrategy": "SHRINK_TEXT"
}
]
}
Next Steps¶
- Continue to step 8, Add the full lab panel.
- Back to step 6, Name the product.
- All tutorial steps