Filters

Filters

Filter definitions for selecting data in fetch and delete operations.

Attribute

Details

Purpose

Define criteria for which records to fetch, delete, or mass-edit

Format

XML — <filters> wrapper with one <filter> element inside

Naming

By entity or purpose: active-products-filter.xml, cars-px-filter.xml. One filter per file.

Loaded by

Spring context at startup — registered as beans by filter ID


Filter Structure

<filter>

The root filter element. It may contain at most one top-level logical combinator (<and>, <or>, or <not>).

Attributes

Attribute

Type

Required

Description

id

string

No

Bean identifier for referencing the filter by name

resultFields

string

No

Comma-separated list of field names to include in the result set. If omitted, all fields are returned.

sortBy

string

No

Field name to sort results by. Prefix with - for descending order (e.g., -modifiedDate).

Child Elements (choice, 0..1)

Element

Description

<or>

Logical OR combinator

<and>

Logical AND combinator

<not>

Logical NOT combinator


Logical Combinators

<and>

All child criteria/combinators must be true for a record to match.

<or>

At least one child criterion/combinator must be true for a record to match.

<not>

Negates all child criteria/combinators. A record matches if the children evaluate to false.

All combinators share these attributes:

Attribute

Type

Required

Description

id

string

No

Bean identifier

objectType

string

No

The Pricefx object type to filter on

resultFields

string

No

Comma-separated list of fields to return

All combinators may contain: <criterion>, <and>, <or>, <not> (0..unbounded).


Criterion Element

<criterion>

Defines a single condition on a field.

Attribute

Type

Required

Description

fieldName

string

Yes

The name of the field to evaluate (e.g., sku, label, attribute1)

operator

operator-types

Yes

The comparison operator (see full list below)

value

string

No

The value to compare against. Not required for isNull/notNull. For inSet/notInSet, use comma-separated values.


All Operators

Equality Operators

Operator

Description

Example

equals

Field value exactly equals the given value

<criterion fieldName="sku" operator="equals" value="PRD-001"/>

notEqual

Field value does not equal the given value

<criterion fieldName="status" operator="notEqual" value="DELETED"/>

Comparison Operators

Operator

Description

greaterThan

Field value is greater than the given value

lessThan

Field value is less than the given value

greaterOrEqual

Field value is greater than or equal

lessOrEqual

Field value is less than or equal

String Matching Operators (Case-Sensitive)

Operator

Description

contains

Field value contains the given substring

startsWith

Field value starts with the given prefix

endsWith

Field value ends with the given suffix

notContains

Field value does not contain the given substring

notStartsWith

Field value does not start with the given prefix

notEndsWith

Field value does not end with the given suffix

String Matching Operators (Case-Insensitive)

Operator

Description

iContains

Case-insensitive contains

iStartsWith

Case-insensitive starts with

iEndsWith

Case-insensitive ends with

iNotContains

Case-insensitive not contains

iNotStartsWith

Case-insensitive not starts with

iNotEndsWith

Case-insensitive not ends with

Null-Check Operators

Operator

Description

isNull

Field value is null (no value attribute needed)

notNull

Field value is not null (no value attribute needed)

Set Operators

Operator

Description

Example

inSet

Field value is one of the given comma-separated values

value="ACTIVE,PENDING,REVIEW"

notInSet

Field value is not one of the given comma-separated values

value="TEST,DEV"

Custom Operator

Operator

Description

custom

A custom/server-side operator for advanced use cases


resultFields

The resultFields attribute is available on <filter>, <and>, <or>, and <not> elements. It specifies a comma-separated list of field names to include in the fetch result. When omitted, all fields are returned.

Using resultFields improves performance by reducing the data transferred from the Pricefx server.

sortBy

The sortBy attribute is available on the <filter> element.

  • Plain field name for ascending order: sortBy="sku"

  • Prefix with - for descending order: sortBy="-modifiedDate"


Examples

Simple Filter -- Single Criterion

One filter per file, wrapped in <filters>:

XML
<filters>
    <filter id="active-products-filter" resultFields="sku,label,attribute1">
        <and>
            <criterion fieldName="attribute1" operator="equals" value="ACTIVE"/>
        </and>
    </filter>
</filters>

AND Filter -- Multiple Criteria

XML
<filters>
    <filter id="expensive-electronics-filter" sortBy="-attribute2">
        <and>
            <criterion fieldName="attribute1" operator="equals" value="Electronics"/>
            <criterion fieldName="attribute2" operator="greaterThan" value="500"/>
            <criterion fieldName="attribute3" operator="notNull"/>
        </and>
    </filter>
</filters>

OR Filter -- Match Any Condition

XML
<filters>
    <filter id="multi-region-filter">
        <or>
            <criterion fieldName="attribute1" operator="equals" value="EMEA"/>
            <criterion fieldName="attribute1" operator="equals" value="NA"/>
            <criterion fieldName="attribute1" operator="equals" value="APAC"/>
        </or>
    </filter>
</filters>

Combined AND/OR -- Nested Logic

XML
<filters>
    <!-- Products that are Electronics AND (in EMEA or NA region) -->
    <filter id="electronics-by-region-filter" resultFields="sku,label,attribute1,attribute2">
        <and>
            <criterion fieldName="attribute1" operator="equals" value="Electronics"/>
            <or>
                <criterion fieldName="attribute2" operator="equals" value="EMEA"/>
                <criterion fieldName="attribute2" operator="equals" value="NA"/>
            </or>
        </and>
    </filter>
</filters>

NOT Filter -- Exclusion

XML
<filters>
    <filter id="non-obsolete-filter">
        <not>
            <criterion fieldName="status" operator="inSet" value="OBSOLETE,DELETED"/>
        </not>
    </filter>
</filters>

Usage with pfx-api Component

Filters are referenced by their id in fetch, delete, and mass-edit operations using the pfx-api component.

pfx-api URI

Purpose

Key Parameters

pfx-api:fetch?objectType=...&filter=myFilter

Fetch Data Source records

objectType (required), filter (required), countOnly (optional)

pfx-api:delete?objectType=...&filter=myFilter

Delete Data Source records

objectType (required), filter (required)

pfx-api:fetch?objectType=LTV&pricingParameterName=...&filter=myFilter

Fetch Pricing Parameter Values

pricingParameterName (required), filter (required)

pfx-api:delete?objectType=LTV&pricingParameterName=...&filter=myFilter

Delete Pricing Parameter Values

pricingParameterName (required), filter (required)

pfx-api:massedit?objectType=...&filter=myFilter

Mass Edit Data Source records

objectType (required), filter (required), child <field> elements

Deprecation notice: The XML bean elements dsFetch, dsDelete, dsMassEdit, ppvFetch, and ppvDelete are deprecated since v1.2.0. Use the pfx-api component directly as shown above.


Common Pitfalls

  • One filter per file — each file must have the <filters> wrapper element around the filter definition. Do NOT use <beans>, <beans:beans>, or XML declarations.

  • Multiple top-level combinators — a <filter> may only contain ONE top-level <and>, <or>, or <not>. Wrap multiple conditions in a single combinator.

  • Missing value for binary operators — all operators except isNull and notNull require a value attribute.

  • Using inSet with spaces — values in inSet/notInSet are comma-separated with no spaces (e.g., value="A,B,C" not value="A, B, C").

  • Filter IDs must match the filter= parameter in route URIs.

  • For dynamic values use value="simple:${header.myValue}".