Skip to content

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.

  1. Add a Text element.
  2. Set X Start to 5%, X End to 95%.
  3. Set Y Start to 65%, Y End to 73%.
  4. Set Value template to {{ package.metadata.indexedLabResults.totalTHC.full }}.
  5. Set Font to Helvetica-Bold and Font size to 10.

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 THC becomes totalTHC, Delta 9 THC becomes delta9THC. Use the autocomplete rather than guessing: it lists the keys your loaded data actually has.

Each entry gives you four ways to use it:

  • .full is the ready made string, Total THC: 18.2 %
  • .name is Total THC
  • .value is the number 18.2
  • .unit is %

Use .full when you want the whole thing, and .value when you are building your own formatting, as we do next.

Labels showing each package's THC percentage

Printed PDF • Layout JSON

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