Meta labels

A Meta label is a special label template that does not contain any printable label designs. Instead, it orchestrates the printing process by defining which label templates to print, what print data they receive, when and in what order they are printed, which printer and output file to use, and the conditions under which individual labels are printed.

Like any other label template, a Meta label receives print data using the standard AzureLabel print data workflow. Print data may come from embedded print data, import settings, a Data Entry Form, the Label print data table, an API, or any other supported source. The resulting print data is then used by the Meta label to control the printing of the referenced label templates.

For example, a Meta label can print:

  • A Job label once at the beginning of the print job.
  • A Product label for every product record.
  • A Box label after each product group.
  • A Pallet label once after all product groups have been printed.

The way print data is distributed to the referenced label templates depends on the selected Rule type.

Create a Meta label

  1. Click New label.
  2. Select New blank label.
  3. Enter the label name and click OK.
  4. In the Label properties window, select Meta label from the Label type list.
    Select the Meta label type

The Label properties window remains open, allowing you to continue configuring the Meta label.

Simple rule type

The Simple rule type creates the print workflow automatically from the rules tree. AzureLabel takes the Meta label's print data, processes the rules tree, and creates a final list of records to print. Each generated record contains the label template that must be printed and the data that must be used for it.

Meta label simple rule type

The original print data is not printed directly. It is used as the source data for generating the final print sequence.

The final print sequence is created in this order:

  1. Labels at the start of printing are generated first. Each of them uses the first source record. If there are no source records, an empty record is used.
  2. Group labels and Primary labels are generated next. If group labels are configured, AzureLabel splits the source records into groups and processes each group in order. If no group labels are configured, all source records are processed directly by the Primary labels.
  3. Labels at the end of printing are generated last. Each of them uses the last source record. If there are no source records, an empty record is used.

For every generated record, AzureLabel sets the label template location and print quantity, checks the print condition, and adds the record to the final print sequence only if the condition is satisfied.

Groups

Groups are created by comparing the values of the selected group field in consecutive source records. When the value changes, the current group ends and a new group begins.

Source records should normally be sorted by the selected group field. Otherwise, records with the same value that are separated by other records are treated as separate groups.

For each group, AzureLabel can generate:

  • Labels at the start of a group — use the first record of the group.
  • Primary labels — use the records inside the group.
  • Labels at the end of a group — use the last record of the group.

If several group fields are used, groups are processed as nested groups, in the order defined by the rules tree.

Creating rules

A Meta label contains labels organized into groups. Each label represents a label template that is printed at a specific stage of the print workflow. The order of the labels in the rules tree determines the order in which they are processed.

Add labels

To add a label:

  1. Select a label group, such as Primary labels or Labels at the start of printing, then click the + button on the toolbar.
    Adding a label to the rules tree
  2. In the dialog that appears, select Add a label to choose a label template from a file, or Add a formula that returns a label name to use a formula that dynamically returns a label template name, relative path, or full path.
    Selecting the label source type
  3. If you select Add a formula that returns a label name, the Formula designer window opens. You can edit the formula later by selecting the label and clicking the Change button on the toolbar.

Label settings

You can configure the following settings for each label in the rules tree.

Label settings in the rules tree
  • Print when. Select Always or On condition. If On condition is selected, the label is printed only if the formula returns 1 or true.
  • Print quantity formula. You can specify a formula that returns the number of copies to print. The formula is evaluated for each generated label, and the returned value overrides the print quantity specified in the print data, if any.

Example rules tree

Meta label simple rule type example

Script rule type

The Script rule type gives you complete control over the printing workflow using JavaScript. Unlike the Simple rule type, where AzureLabel automatically creates the final print sequence from the rules tree, the Script rule type lets your script create and modify the print sequence programmatically.

The script can:

  • Create, modify, and delete print records.
  • Select which label template each record prints.
  • Choose the printer and output file for each record.
  • Set the print quantity.
  • Implement any custom printing workflow.

The script receives the Meta label's print data and can use it directly, modify it, or generate an entirely new print sequence.

Example of a script

// Create two print records that print different label templates.

azureLabel.clearRecords();

azureLabel.insertRecord(0);
azureLabel.insertRecord(0);

azureLabel.setFieldValue('label', 'Product label', 0);
azureLabel.setFieldValue('printer', 'Zebra 987', 0);
azureLabel.setFieldValue('PrintQuantity', 4, 0);
azureLabel.setFieldValue('name', 'Product A', 0);
azureLabel.setFieldValue('price', 4.99, 0);
azureLabel.setFieldValue('barcode', '123456789012', 0);
azureLabel.setFieldValue('QR code', 'https://azurelabel.com', 0);

azureLabel.setFieldValue('label', 'Box label', 1);
azureLabel.setFieldValue('printer', 'Brother 876', 1);
azureLabel.setFieldValue('PrintQuantity', 2, 1);
azureLabel.setFieldValue('box number', 'BOX-001', 1);
azureLabel.setFieldValue('barcode', 'BOX001', 1);