Generic metadata for entities - LabelHub/labelhub.integration.documentation GitHub Wiki

MetaData on entities

LabelHub supports generic metadata on entities. These can be added in an XML import and will automatically be added to the entity after it has been create/updated. Metadata consists of a type, a key and a value(s). Depending on the type of metadata there can be requirements to the contents of the value.

Properties

Name Type Required Default Notes
key string Yes A unique key for the metadata, the same key can only exist once per entity. Only use A-Z, a-z and 0-9, no special characters like spaces, tabs or dashes
type enum MetaDataType_Text See MetaData data types for information
behaviour enum MetaDataBehaviour_None See MetaData behaviours for information
values string[] Yes Note that this can be a list of values, so even a single value must be specified as an array

MetaData data types

MetaData in LabelHub can have different datatypes. The datatype has no structural significance, but are instead used for correctly displaying information in the frontend. The datatype can also have significance during integrations, where data manipulation occurs.

Datatype Notes
MetaDataType_Text Simple string representation, which will be displayed as-is.
MetaDataType_Numeric Numeric value which will be displayed in the frontend with correct formatting according to the users locale setting. The values stored on the metadata must be formatted as proper json numbers, e.g 1234.67
MetaDataType_Hyperlink The value must be created using markdown-notation, so [text](url)

MetaData behaviours

Metadata in LabelHub can "behave" in different ways depending on what the metadata will be used for. Some metadata is just plain information while others are critical "keys" that needs to be searchable and be included in filters.

Datatype Notes
MetaDataBehaviour_None The metadata is just stored as-is and will be displayed inside LabelHub
MetaDataBehaviour_Indexed The metadata will be indexed on the related entity for searching and filtering.

Note: Always use the None-behaviour if at all possible. Having many indexed metadata on entities can affect performance and can give excessive "false positives" when searching in LabelHub. It is therefore the recommendation to careful consider, if the data needs to be indexed or not. If there is any doubt about what to do in a specific usecase, please contact your LabelHub representative!

Sample

Metadata in Label-entity

<?xml version="1.0" encoding="UTF-8"?>
<label version="6">
  <labelNoManufacturer>lbl123</labelNoManufacturer>
  ...
  <metadata>
    <metadata>
      <key>InternalIDs</key>
      <behaviour>MetaDataBehaviour_Indexed</behaviour>
      <values>
        <value>1234</value>
        <value>PPT-1234</value>
      </values>
    </metadata>
    <metadata>
      <key>CustReference</key>
      <values>
        <value>PO8474</value>
      </values>
    </metadata>
  </metadata> 
</label>

Metadata in Impose-command

<?xml version="1.0" encoding="UTF-8"?>
<imposecommand version="1">
  <identifier>order_123</identifier>
  ...
  <labels>
    <label>
      <labelNoManufacturer>101010</labelNoManufacturer>
      <row>0</row>
      <column>1</column>
      <rotation>90</rotation>
    </label>
    ...
  </labels>
  <metadata>
    <metadata>
      <key>SomeReference</key>
      <behaviour>MetaDataBehaviour_Indexed</behaviour>
      <values>
        <value>PO8474</value>
      </values>
    </metadata>
    <metadata>
      <key>SomePriceInfo</key>
      <type>MetaDataType_Numeric</type>
      <values>
        <value>15275.00</value>
      </values>
    </metadata>
  </metadata> 
</imposecommand>
⚠️ **GitHub.com Fallback** ⚠️