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 layer and set its Layer description to Potency.
  2. Drag it into a strip below the tag number: X: 5% – 95%, Y: 65% – 73%.
  3. Set Value template to {{ package.metadata.indexedLabResults.totalTHC.full }}.
  4. Set Font Size to 10 and Resize Strategy to Shrink Text.
  5. Make it Helvetica-Bold in Current layout JSON, as in the last step.

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, with one camelCase key per test however the lab spelled it. Total THC and Total Delta-9 THC both become totalTHC, and THCa becomes THCA. Lab Result Keys lists every key, and Insert Field lists the keys your loaded data 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": [
    {
      "description": "Tag barcode",
      "elementType": "CODE128_BARCODE",
      "xStartFraction": 0.05,
      "xEndFraction": 0.95,
      "yStartFraction": 0.46,
      "yEndFraction": 0.66,
      "valueTemplate": "{{ package.label }}"
    },
    {
      "description": "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"
    },
    {
      "description": "Logo",
      "elementType": "IMAGE",
      "xStartFraction": 0.25,
      "xEndFraction": 0.75,
      "yStartFraction": 0.84,
      "yEndFraction": 0.98,
      "valueTemplate": "{{ images['logo.png'] }}"
    },
    {
      "description": "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"
    },
    {
      "description": "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