Postman collection
Items Write

pixiTagMatchAddForItems

Assigns one or more item tags to items given as XML and returns one status row per requested tag/item assignment.

Creates entries in TagMatch that link tags of type 1 (item tags) to items.

Input processing

  • TagsXML is parsed with OPENXML on the path /Tags/Item/TagList/Tag (element-centric). Every Tag element is one requested assignment.
  • TagId is read from the Tag element; ItemId and ItemNrInt are read from the parent Item element. The values 0 and the empty string are treated as missing.
  • The item is resolved as follows: if ItemId is given, it is used as is. Otherwise ItemNrInt is looked up in pixi.ItemCode (Code with CodeTypeId = 2) to find the item key.

Validation, in this order

  1. Requests where the item key does not exist in items or the tag does not exist in Tag with TypeId = 1 get a status:
    • TagId missing, or TagId given but neither ItemId nor ItemNrInt given: Error / Mandatory parameter is missing.
    • ItemNrInt not found, ItemId unknown, or tag unknown or not an item tag: Error / One of the provided values is not valid.
  2. Remaining requests where the tag/item pair already exists in TagMatch (for a tag of type 1): Warning / Tag is already assigned to that item.
  3. All other requests: Success / Tag was successfully assigned to item. These pairs are inserted into TagMatch (duplicates within the XML are inserted only once).

Result

One row per requested assignment, ordered by the position of the Tag element in the XML, with the tag ID, the resolved item ID, the item number given, and Status/Message.

Notes

  • The procedure runs in its own transaction, or sets a savepoint if the caller already has an open transaction.
  • Lookups on items, Tag, TagMatch and pixi.ItemCode use NOLOCK; concurrent calls may therefore insert the same pair twice or see uncommitted data.
  • If an unexpected error occurs, the transaction is rolled back and the error is logged via log.InsertError (not attached). The CATCH block sets an "Unexpected error" message internally but does not return it as a row, so the caller receives no result set in that case. Whether log.InsertError re-raises the error is not visible in the code.
  • ItemId takes precedence over ItemNrInt; if both are given, ItemNrInt is only echoed back.
  • If an ItemNrInt matches several pixi.ItemCode entries, the request may produce several result rows.
  • Tags whose TypeId is not 1 are rejected as invalid.

Tables used

TagMatch · Write Tag · Read items · Read ItemCode · Read
SQL object:
dbo.pipiTagMatchAddForItems
Updated at 2026-10-30