Filtering rules

Filtering rules are criteria that Feed Utility uses to filter the original feed files.

Filtering rules are specified for each feed in a Filters element. Each filtering rule is set in a Field element: the field name is specified in the name attribute and the filtering criteria are specified in the value attribute. A field can have only one filtering rule associated with it; you cannot have two Field parameters for one field.

The following is an example of filtering rules for a feed. These rules specify that the output feed must include only records that have the popularity field equal to 4 or 5 and the mask field containing .ru or .com.

<Feed>

...

<Filters>

<Field name="popularity" value="4;5"/>

<Field name="mask" value=".ru;.com"/>

</Filters>

...

<Feed>

Feed Utility ignores leading and terminating space symbols, or tab symbols in the value of the "value" attribute.

Only those records that match all the specified criteria are included in the output file. If a filtering criterion is specified for a field, and the field is missing from a record, Feed Utility will not include this record in the output file.

Defining filtering criteria for numeric values

Numeric values are integers. Decimal values are not supported.

You can define filtering criteria for numeric fields in the following ways:

Defining filtering criteria for strings

You can define filtering criteria for string fields in the following ways:

Defining filtering criteria for dates

Date values in feeds are formatted either in the pattern "DD.MM.YYYY" (for example, "26.04.2014"), in the pattern "YYYY-MM-DD" (for example "2014-04-26"), or in the pattern "MM/DD/YYYY" (for example, "04/26/2014").

You can define filtering criteria for fields with dates in the following ways:

Excluding records with missing fields

In the original feed files, some records can have extra fields or can lack some fields. For records with extra fields, Feed Utility includes only those fields that are specified in the RequiredFields element of feed rules for a specified feed. For records that lack some fields, Feed Utility includes such records in the output if they contain at least one of the fields specified in the RequiredFields element. If some fields specified in the RequiredFields element are missing from a record in the original feed, the record in the processed feed will not contain them.

If you want to exclude records with missing fields from the output, you must create filtering rules for all required fields.

In the following example, Feed Utility will include records that have popularity, or mask, or both popularity and mask, fields.

<RequiredFields>popularity;mask</RequiredFields>

If you want Feed Utility to include only those records that have both popularity and mask, create a filtering rule for both fields. You can specify criteria for field values, or use an asterisk (*) to specify any value.

In the following example, only records that have both fields (mask and popularity) are included in the resulting feed.

<Filters>

<Field name="popularity" value="*"/>

<Field name="mask" value="*"/>

</Filters>

<RequiredFields>popularity;mask</RequiredFields>

You can specify exact criteria, in the same manner. The following example instructs Feed Utility to include only records that have the popularity field with a value of 5 and the mask field with any value.

<Filters>

<Field name="popularity" value="5"/>

<Field name="mask" value="*"/>

</Filters>

<RequiredFields>popularity;mask</RequiredFields>

Page top