Simple Filter (equals, contains)

Overview

Filters in Integration Manager define criteria for fetching data from Pricefx. The simplest filters use a single <criterion> element inside an <and> block. Each criterion specifies a field name, an operator, and (for most operators) a value to match against.

Complete XML Examples

Equals Operator

Match records where a field has an exact value:

XML
<filters>
    <filter id="filterByStatus">
        <and>
            <criterion fieldName="attribute1" operator="equals" value="ACTIVE"/>
        </and>
    </filter>
</filters>

Not Equal Operator

Exclude records with a specific value:

XML
<filters>
    <filter id="excludeDeleted">
        <and>
            <criterion fieldName="attribute14" operator="notEqual" value="88"/>
        </and>
    </filter>
</filters>

Contains and iContains (Case-Insensitive)

Match records where a field contains a substring:

XML
<filters>
    <filter id="filterByNameContains">
        <and>
            <!-- Case-sensitive contains -->
            <criterion fieldName="label" operator="contains" value="Premium"/>
        </and>
    </filter>

    <filter id="filterByNameCaseInsensitive">
        <and>
            <!-- Case-insensitive contains -->
            <criterion fieldName="attribute17" operator="iContains" value="Test"/>
        </and>
    </filter>
</filters>

StartsWith Operator

Match records where a field starts with a given prefix:

XML
<filters>
    <filter id="filterBySku">
        <and>
            <criterion fieldName="sku" operator="startsWith" value="PROD-"/>
        </and>
    </filter>
</filters>

NotNull Operator

Select records where a field has any non-null value (no value attribute needed):

XML
<filters>
    <filter id="filterNonNullLabels">
        <and>
            <criterion fieldName="label" operator="notNull"/>
        </and>
    </filter>
</filters>

Empty And Block (Fetch All Records)

An empty <and> block with no criteria fetches all records:

XML
<filters>
    <filter id="fetchAllProducts">
        <and/>
    </filter>
</filters>

How It Works

  1. <filters> is the root wrapper element containing one or more <filter> definitions.

  2. <filter id="..."> defines a named filter that can be referenced from route endpoints via filter=filterId.

  3. <and> wraps criteria that must all be true (logical AND). Even a single criterion needs an <and> wrapper.

  4. <criterion> attributes:

    • fieldName -- the Pricefx object field to filter on (e.g., sku, label, attribute1).

    • operator -- the comparison operator (equals, notEqual, contains, iContains, startsWith, notNull, greaterThan, lessThan, iBetween, etc.).

    • value -- the value to compare against (omitted for unary operators like notNull).

  5. Filters are used with fetch endpoints: pfx-api:fetch?objectType=P&filter=filterByStatus.

Common Pitfalls

  • Missing <and> wrapper: Every filter must have at least one <and> or <or> block. A <criterion> directly inside <filter> is not valid.

  • Case sensitivity: equals is case-sensitive. Use iEquals or iContains for case-insensitive matching where available.

  • Value type: The value attribute is always a string. Pricefx performs type coercion based on the field type server-side, but mismatches can cause unexpected results.

  • Empty filter performance: An empty <and/> fetches ALL records. For large datasets, always add criteria or use resultFields to limit the response.

  • Operator spelling: Operators are camelCase (notNull, notEqual, startsWith). Incorrect casing will produce an error.