Help Center

Feed: How to use Feed Rule Operators

Yesenia DeSalle
Yesenia DeSalle
  • Updated

Feed rules in GoDataFeed act like SQL queries, allowing you to manipulate and optimize your product data before sending it to various shopping channels and marketplaces. Each rule consists of three key components:

  • SET field: Defines the new value or transformation to be applied to the target field.
  • TO field: Specifies the target field in your feed that you want to modify or populate.
  • WHERE condition: Establishes the criteria for which products the rule should be applied to. This is where comparison operators come into play.

Understanding Comparison Operators

Comparison operators are essential for constructing WHERE conditions in feed rules. They allow you to compare values in your feed data and determine which products meet specific criteria. GoDataFeed offers a variety of comparison operators, including:

  • Equals (=): Checks if two values are identical.

  • Not Equals (<>): Checks if two values are different.

  • Greater Than (>): Checks if the left value is greater than the right value.

  • Less Than (<): Checks if the left value is less than the right value.

  • Greater Than or Equal To (>=): Checks if the left value is greater than or equal to the right value.

  • Less Than or Equal To (<=): Checks if the left value is less than or equal to the right value.

Static Text vs. Variables

In GoDataFeed, WHERE conditions can utilize both static text and variables for comparisons.

  • Static Text: This refers to fixed values like numbers (e.g., 100) or text (e.g., "instock").

  • Variables: These are dynamic values represented as [P].[Name], where "P" signifies "Product" and "Name" refers to the specific field in your product data (e.g., [P].[Price] or [P].[ImageURL]).

Using variables allows you to create more flexible and dynamic rules that adapt to the specific values of each product.

And now, GoDataFeed introduces brand new comparison operators to further enhance your feed rule capabilities.

New Comparison Operators

The following table summarizes the new comparison operators and their functions:

Operator

Description

Example (with variable)

IMGW<

Image Width Less Than (pixels)

[P].[ImageURL] IMGW< 300 (targets products with image widths less than 300 pixels)

IMGW>

Image Width Greater Than (pixels)

[P].[ImageURL] IMGW> 1000 (targets products with image widths greater than 1000 pixels)

IMGW=

Image Width Equal To (pixels)

[P].[ImageURL] IMGW= 800 (targets products with image widths equal to 800 pixels)

IMGH<

Image Height Less Than (pixels)

[P].[ImageURL] IMGH< 300 (targets products with image heights less than 300 pixels)

IMGH>

Image Height Greater Than (pixels)

[P].[ImageURL] IMGH> 1000 (targets products with image heights greater than 1000 pixels)

IMGH=

Image Height Equal To (pixels)

[P].[ImageURL] IMGH= 800 (targets products with image heights equal to 800 pixels)

SIZE<

File Size Less Than (bytes)

[P].[ImageURL] SIZE< 1048576 (targets products with file sizes less than 1 MB)

SIZE>

File Size Greater Than (bytes)

[P].[ImageURL] SIZE> 5242880 (targets products with file sizes greater than 5 MB)

SIZE=

File Size Equal To (bytes)

[P].[ImageURL] SIZE= 2097152 (targets products with file sizes equal to 2 MB)

STAT=

HTTP Status Code Equal To

[P].[ProductURL] STAT= 200 (targets products with successful HTTP requests)

STA<>

HTTP Status Code Not Equal To

[P].[ProductURL] STA<> 404 (targets products with unsuccessful HTTP requests, excluding "Not Found")

Image Dimension Comparisons

The new IMGW and IMGH operators allow you to create rules based on specific image width and height requirements. This is particularly useful for:

  • Ensuring image quality: Target products with small images and replace them with higher resolution versions.

  • Meeting marketplace image guidelines: Filter out products that don't meet specific image dimension requirements of certain channels.

  • Optimizing image sizes: Identify images that are unnecessarily large and resize them for faster loading times.

File Size Comparisons

The SIZE operators enable you to create rules based on file sizes. This can be helpful for:

  • Managing storage space: Identify and remove products with excessively large files.

  • Improving download speeds: Target products with large files and compress them for better user experience.

  • Meeting file size limits: Filter out products that exceed file size restrictions on certain platforms.

HTTP Status Code Comparisons

The STAT and STA<> operators provide the ability to create rules based on HTTP status codes returned when accessing product URLs. This is useful for:

  • Identifying broken links: Target products with 404 status codes and update their URLs or remove them from your feed.

  • Monitoring website availability: Track product URLs returning 500-level errors and investigate potential server issues.

  • Improving data quality: Ensure product URLs are accessible and functioning correctly.

Examples of Use Cases

Here are a few examples of how the new comparison operators can be used in feed rules:

Example 1: Replacing Low-Resolution Images

This rule targets products with image widths or heights less than 500 pixels and replaces their image URLs with links to higher resolution versions.

Example 2: Filtering Products Based on File Size

  • SET: Exclude

  • TO: TRUE

  • WHERE: [P].[ImageURL] SIZE> 10485760

This rule excludes products whose image file sizes exceed 10 MB from the feed.

Example 3: Checking for Broken Links

  • SET: Availability

  • TO: Out of Stock

  • WHERE: [P].[ProductURL] STA<> 200

This rule sets the availability to "Out of Stock" for products whose URLs return any HTTP status code other than 200 (success).

Additional Tips

  • Combine multiple conditions: Use AND/OR operators to create more complex WHERE clauses.

  • Use parentheses for clarity: Group conditions within parentheses to define the order of evaluation.

  • Test your rules: Always test your rules before applying them to your entire feed to ensure they work as intended.

  • Explore other operators: GoDataFeed offers a variety of other comparison and logical operators to further refine your feed rules. Refer to the GoDataFeed documentation for a complete list and detailed explanations.

Related to

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.