Postman collection
Orders Read

pixiOrderGetByTags

Returns orders in a date range filtered by order tags combined with AND, OR and NOT conditions passed as XML.

Searches orders by their assigned tags. The filter is passed as XML in TagFilter.

Parsing and validation

  • The XML is read from /TagFilter/AND, /TagFilter/OR and /TagFilter/NOT. Each block can contain any number of TagId and TagName elements. Tag names are trimmed, and empty names are ignored.
  • Each entry is resolved against the tags of type 2 (order tags):
    • by Id when TagId is given;
    • by exact Name when PartialTagNameMatch = 0;
    • by Name LIKE '%…%' when PartialTagNameMatch = 1.
  • A partial name match can resolve one entry to several tags.
  • An entry that resolves to no tag gets the status ERROR.
  • A tag that appears more than once in the resolved list also gets ERROR. This applies across operations and also within the same operation, for example when it is referenced both by Id and by name.
  • If any entry has an error, the call returns the complete validation list (one row per resolved entry) and no orders.
  • If the XML cannot be parsed (or a TagId is not numeric), a single error row is returned.

Order search (only if validation passed)

  • DateFrom defaults to 6 months before now, DateTo to now, and RowCount to 1000.
  • The date range is turned into a key range. It starts at the smallest OrderHeaderKey with OrderDate >= DateFrom and ends at the largest OrderHeaderKey with OrderDate < DateTo. All orders whose key lies in this range are considered.
  • NOT: the order must not carry any of the NOT tags.
  • OR: the order must carry at least one of the OR tags.
  • AND: the order must carry all of the AND tags.
  • Blocks that are left empty are not applied. If the filter contains no tags at all (or TagFilter is empty), all orders in the range are returned.
  • The result is limited to TOP (RowCount) and sorted by OrderHeaderKey ascending.

Notes

  • All reads use NOLOCK, so uncommitted data may be returned.
  • StrictANDCondition is marked obsolete and is not used.
  • The date filter works on the key range, not on OrderDate itself. Orders whose key lies inside the range but whose date is outside it are still returned.
  • DateTo is exclusive.
  • If no order matches a date bound, the key range is empty and no rows are returned.
  • The AND check compares the number of matching tag assignments with the number of AND tags. Duplicate assignments of the same tag to an order could distort it.
  • With PartialTagNameMatch = 1, every tag matched by the name pattern counts as a separate tag. In AND, this means all matched tags are required.
  • A code comment notes that the OR condition may not work properly.
  • The message Tag used in another operation is also set when the same tag is referenced twice within one operation.
  • Both possible first result sets arrive as SqlRowSet1. Check for the Status column to distinguish the validation list from the order list.
  • A negative RowCount raises a SQL error outside the error handling.

Tables used

Tag · Read TagMatch · Read OrderHeader · Read
SQL object:
dbo.pipiOrderGetByTags
Updated at 2026-10-30