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 — |
|
Naming |
By entity or purpose: |
|
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 |
|---|---|---|---|
|
|
string |
No |
Bean identifier for referencing the filter by name |
|
|
string |
No |
Comma-separated list of field names to include in the result set. If omitted, all fields are returned. |
|
|
string |
No |
Field name to sort results by. Prefix with |
Child Elements (choice, 0..1)
|
Element |
Description |
|---|---|
|
|
Logical OR combinator |
|
|
Logical AND combinator |
|
|
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 |
|---|---|---|---|
|
|
string |
No |
Bean identifier |
|
|
string |
No |
The Pricefx object type to filter on |
|
|
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 |
|---|---|---|---|
|
|
string |
Yes |
The name of the field to evaluate (e.g., |
|
|
operator-types |
Yes |
The comparison operator (see full list below) |
|
|
string |
No |
The value to compare against. Not required for |
All Operators
Equality Operators
|
Operator |
Description |
Example |
|---|---|---|
|
|
Field value exactly equals the given value |
|
|
|
Field value does not equal the given value |
|
Comparison Operators
|
Operator |
Description |
|---|---|
|
|
Field value is greater than the given value |
|
|
Field value is less than the given value |
|
|
Field value is greater than or equal |
|
|
Field value is less than or equal |
String Matching Operators (Case-Sensitive)
|
Operator |
Description |
|---|---|
|
|
Field value contains the given substring |
|
|
Field value starts with the given prefix |
|
|
Field value ends with the given suffix |
|
|
Field value does not contain the given substring |
|
|
Field value does not start with the given prefix |
|
|
Field value does not end with the given suffix |
String Matching Operators (Case-Insensitive)
|
Operator |
Description |
|---|---|
|
|
Case-insensitive contains |
|
|
Case-insensitive starts with |
|
|
Case-insensitive ends with |
|
|
Case-insensitive not contains |
|
|
Case-insensitive not starts with |
|
|
Case-insensitive not ends with |
Null-Check Operators
|
Operator |
Description |
|---|---|
|
|
Field value is null (no |
|
|
Field value is not null (no |
Set Operators
|
Operator |
Description |
Example |
|---|---|---|
|
|
Field value is one of the given comma-separated values |
|
|
|
Field value is not one of the given comma-separated values |
|
Custom Operator
|
Operator |
Description |
|---|---|
|
|
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>:
<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
<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
<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
<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
<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 |
|---|---|---|
|
|
Fetch Data Source records |
|
|
|
Delete Data Source records |
|
|
|
Fetch Pricing Parameter Values |
|
|
|
Delete Pricing Parameter Values |
|
|
|
Mass Edit Data Source records |
|
Deprecation notice: The XML bean elements
dsFetch,dsDelete,dsMassEdit,ppvFetch, andppvDeleteare deprecated since v1.2.0. Use thepfx-apicomponent 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
valuefor binary operators — all operators exceptisNullandnotNullrequire avalueattribute. -
Using
inSetwith spaces — values ininSet/notInSetare comma-separated with no spaces (e.g.,value="A,B,C"notvalue="A, B, C"). -
Filter IDs must match the
filter=parameter in route URIs. -
For dynamic values use
value="simple:${header.myValue}".