Postman collection
Items Read

pixiItemGetByTags

Returns items whose assigned tags match an XML tag filter with AND, OR and NOT groups, identifying tags by ID or by (partial) name.

Searches items by the tags assigned to them (table TagMatch).

1. Parsing the filter

TagFilter is an XML document with a root TagFilter and the groups AND, OR and NOT. Each group can contain any number of TagId and TagName elements. Names are trimmed; empty names count as missing.

2. Resolving tags

Each entry is resolved against tags of type TypeId = 1:

  • TagId is compared with the tag ID.
  • TagName is compared exactly when PartialTagNameMatch = 0, or with LIKE '%name%' when PartialTagNameMatch = 1. A partial name can resolve to several tags.

3. Validation

The call stops with a status result set and returns no items when:

  • an entry cannot be resolved to any tag, or
  • the same tag is resolved more than once. This applies across groups, within a group, and when a tag is given both by ID and by name.

In that case one row is returned per filter entry:

  • Faulty entries get Status = ERROR.
  • Valid entries get OK with Complete match on TagName, Partial match on TagName or Complete match on TagId.

4. Selecting items

Only items that have at least one tag assigned in TagMatch are considered. An item is returned if it has none of the NOT tags and at least one of these is true:

  • no AND and no OR tags were given (only NOT, or an empty filter);
  • it has all AND tags. With StrictANDCondition = 1 it must also have no other tags at all, so its tag set equals the AND set exactly;
  • it has at least one OR tag.

AND and OR are combined with OR. OR tags therefore widen the result instead of narrowing it.

The result contains ItemId, ItemNrInt and ItemName. Rows are distinct and not sorted.

Notes

  • All tables are read with NOLOCK, so uncommitted data may be read.
  • The conversion of TagFilter to XML happens before the error handling. Malformed XML therefore comes back as a SQL error (SqlMessage), not as a status row.
  • A non-numeric TagId value causes a conversion error inside the error handling. The result is the single status row Unexpected error occured while parsing the @TagFilter parameter.
  • The behaviour for a NULL TagFilter is not handled explicitly in the code.
  • Only tags with TypeId = 1 can be used in the filter.
  • The strict AND check considers every tag assigned to the item in TagMatch, regardless of its type.
  • The procedure returns 1 after a status result set. Status rows and item rows never appear in the same call; both arrive as SqlRowSet1. Check for a Status column to tell them apart.
  • With PartialTagNameMatch = 1, a short name can hit several tags. It can easily overlap with other entries and trigger Tag used in another operation.

Tables used

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