Skip to main content

Introduction to the label_elements Table

The label_elements table is designed to store information about individual elements within label designs. This table plays a crucial role in the Serial application’s labeling system by maintaining detailed data for various types of label components, such as text, images, barcodes, QR codes, and identifiers.

Table Structure

The label_elements table is structured to capture the diverse attributes of different label element types. Here’s a detailed breakdown of its columns:
Column NameData TypeConstraintsDescription
iduuidprimary keyUnique identifier for each label element
label_format_iduuidforeign keyReferences the associated label format
company_iduuidforeign keyReferences the company owning the element
typevarchar(50)check (‘BARCODE’, ‘QR_CODE’, ‘IDENTIFIER’, ‘TEXT’, ‘IMAGE’)Type of the label element
xfloatHorizontal position in mm (absolute position only)
yfloatVertical position in mm (absolute position only)
texttextContent for TextElement
font_sizefloatFont size for TextElement and IdentifierElement
boldbooleanBold style for TextElement
italicbooleanItalic style for TextElement
underlinebooleanUnderline style for TextElement
file_iduuidReferences the associated file for ImageElement
widthfloatWidth in mm for ImageElement, BarcodeElement, and QrCodeElement
heightfloatHeight in mm for BarcodeElement

Usage and Functionality

The label_elements table is designed to be flexible and accommodate various types of label elements. Here are some key points about its usage:
  1. Element Type Diversity: The table supports multiple element types (Text, Image, Barcode, QR Code, Identifier) through the ‘type’ column, allowing for versatile label designs.
  2. Position and Sizing: The ‘x’ and ‘y’ columns define the element’s position on the label, while ‘width’ and ‘height’ specify dimensions for applicable element types.
  3. Text Formatting: For text elements, the table stores formatting information such as font size, bold, italic, and underline styles.
  4. Company-Specific Data: The ‘company_id’ column ensures that label elements are associated with specific companies, supporting multi-tenant functionality.

Notes

  • The LabelElementType enum in TypeScript corresponds to the ‘type’ column in this table:
    export enum LabelElementType {
      Barcode = "BARCODE",
      QRCode = "QR_CODE",
      Identifier = "IDENTIFIER",
      Text = "TEXT",
      Image = "IMAGE",
    }
    
  • The label_elements table works in conjunction with the label_formats table to create complete label designs.
By leveraging the label_elements table, the Serial application can store and manage detailed information about various components of label designs, enabling flexible and customizable label creation for different companies and use cases.