Postman collection
Items Write

pixiSetItemTags

Synchronises the prefixed item tags of the items given in an XML document: creates missing tags, adds new tag assignments and removes prefixed assignments no longer listed.

Sets the tags of one or more items from the XML document in TagsXML. The call works as a replace per item for all tags whose name starts with TagPrefix.

Steps:

  1. Every /ItemTags/Item/TagList/Tag element becomes one row. The tag name is stored as TagPrefix + Name (an empty Name gives no name). Empty values for ItemNrInt, EANUPC and ItemKey = 0 are treated as missing.
  2. The item is resolved in three passes against Items: first by ItemKey, then by ItemNrInt, then by EANUPC. A later match overwrites an earlier one, so if several identifiers are given and point to different items, the EAN match wins. Rows whose item cannot be found are silently dropped.
  3. Tags (type 1, not a system tag) that do not exist yet by name are created in Tag. If the same tag name appears with different descriptions, the alphabetically highest description is used; an empty description is stored as empty string. Descriptions of existing tags are not changed.
  4. For each item contained in the XML, all existing assignments in TagMatch to tags of type 1 whose name matches TagPrefix% and which are not listed for that item are deleted. Tags without the prefix are not touched. An item sent only with an empty tag name therefore loses all its prefixed tags.
  5. Listed tag assignments that do not exist yet are inserted into TagMatch.

The result lists the newly inserted assignments with Action = ADDED. Items that were sent with an empty tag name additionally appear once with Action = DELETED and TagKey/TagName empty. The individual removed assignments are not returned.

Notes

  • No explicit transaction: tag creation, deletions and inserts are separate statements; a failure in between can leave a partial state.
  • Reads of Items and Tag use NOLOCK.
  • TagPrefix is used in a LIKE pattern; % or _ in the prefix act as wildcards and can widen the set of tags that get removed. An empty prefix makes all type-1 tags of the listed items subject to removal. A NULL prefix yields no tag names, so nothing is added and nothing is removed.
  • The XML element Name is read as varchar(50), Description as varchar(500), EANUPC as varchar(13); longer values are truncated. Whether prefix + name fits into Tag.Name depends on the table definition, which is not visible.
  • The XML document handle from sp_xml_preparedocument is never released with sp_xml_removedocument; it stays allocated until the connection ends.
  • No error rows are returned; unknown items are ignored silently.

Tables used

Items · Read Tag · Write TagMatch · Write
SQL object:
dbo.pipiSetItemTags
Updated at 2026-10-30