Using logical operations

How to use logical operations in Plytix formulas, with real examples of when you'd use each one

Logical operations let you test conditions, combine multiple conditions together, and control what a formula outputs based on the result, including handling blank, null, or error values gracefully. This article covers all nine logical operations, plus common use cases combining them.

AND

Tests multiple conditions together. Returns TRUE only if every provided condition is true; returns FALSE if any of them are false. Only FALSE and 0 are considered false.

Syntax:

AND(logical_expression1, [logical_expression2, ...])
  • logical_expression1: an expression that represents or can represent a logical value (TRUE or FALSE).
  • logical_expression2, … (optional): additional expressions.

Example:

$ATT.BOOLEAN = 1

AND($ATT.BOOLEAN, true)

Result: TRUE

OR

Tests multiple condition options. Returns TRUE if any of the provided conditions are true.

Syntax:

$ATT.BOOLEAN = 1

AND($ATT.BOOLEAN, true)
  • logical_expression1: an expression that represents a logical value, or can be coerced to one.
  • logical_expression2, ... (optional): additional expressions.

Example:

OR(logical_expression1, [logical_expression2, ...])

Result: true

Formula in use:

OR(0, True, Null)

This combines EQ, OR, and IF to say: if the Status is "Draft" or is empty, the output should be "Inactive."

NOT

Returns the opposite of a provided logical value.

Syntax:

IF(OR(EQ($ATT.STATUS, "Draft"), EQ($ATT.STATUS, "")), "Inactive")
  • logical_expression: an expression that represents a logical value (TRUE or FALSE).

Example:

NOT(true)

Result: false

IF

Returns one value if a condition is true, and optionally a different value if it's false.

Syntax:

IF(logical_expression, value_if_true, value_if_false)
  • logical_expression: an expression representing a logical value.
  • value_if_true: the value returned if the expression is TRUE.
  • value_if_false (optional, blank by default): the value returned if the expression is FALSE.

Example:

IF(EQ(1, 1), "equal", "different")

Result: equal

Formula in use: conditional brand insertion

Checks whether a description already contains the brand name. If it does, the description is left as-is; if not, the brand name is added to the front.

For example, if the brand is “Nitro” and the description is “Snowboard for kids,” this inserts the brand to produce “Nitro Snowboard for kids.” If the description already reads “Snowboard for kids from Nitro,” it’s left unchanged, since it already contains “Nitro.”

IF(GT(SEARCH($ATT.BRAND, $ATT.DESCRIPTION), 0), $ATT.DESCRIPTION, CONCAT($ATT.BRAND, " ", $ATT.DESCRIPTION))

IFBLANK

Defines what a formula should output if a field is blank.

Syntax:

IFBLANK(value1, value_if_blank)
  • value1: the value to test.
  • value_if_blank: the value to return if value1 is blank.

Example:

IFBLANK($ATT.LABEL, "Not Available")

If $ATT.LABEL is blank, result: Not Available

 If the attribute you reference does contain a value (and isn’t blank), the formula’s result is simply that value. Keep this in mind when combining this with other formulas that reference the same attribute.

IFNULL

Defines what a formula should output if a value is null.

Syntax:

IFNULL(value1, value_if_null)
  • value1: the value to test.
  • value_if_null: the value to return if value1 is NULL.

Example:

IFNULL(NULL, "Not Defined")

Result: Not Defined

IFERROR

Defines what a formula should output if it would otherwise return an error.

Syntax:

IFERROR(value1, value_if_error)
  • value1: the value to test.
  • value_if_error: the value to return if value1 is an error.

Example:

IFERROR(#error, "N/A")

Result: N/A

CONTAINS_ALL

Determines whether every value in a given set is found within another set. Case sensitive.

Syntax:

CONTAINS_ALL(attribute, [value(s)])
  • attribute: the attribute checked for all the given values.
  • value(s): the data to check for.

Example:

$ATT.LABEL = Beautiful Blue Bicycle

CONTAINS_ALL($ATT.LABEL, ["Blue", "Red"])

Result: False

The label contains “Blue” but not “Red,” so not every value in the set is present, hence False.

CONTAINS_ANY

Determines whether any value in a given set is found within another set. Case sensitive.

Syntax:

CONTAINS_ANY(attribute, [value(s)])
  • attribute: the attribute checked for any of the given values.
  • value(s): the data to check for.

Example:

$ATT.LABEL = Beautiful Blue Bicycle

CONTAINS_ANY($ATT.LABEL, ["Blue", "Red"])

Result: True

The label contains “Blue,” so at least one value in the set is present, hence True.

Common Use Cases for Logical Operations

Marking a product "Ready to publish" only when everything's filled in

Use AND combined with IF to require several conditions to all be true before flagging a product as ready:

$ATT.LABEL = Beautiful Blue Bicycle

CONTAINS_ANY($ATT.LABEL, ["Blue", "Red"])

Flagging a product as inactive based on multiple possible statuses

Use OR to check for several equivalent "inactive" states at once, rather than writing a separate condition for each:

IF(AND(NOT(ISBLANK($ATT.PRICE)), NOT(ISBLANK($ATT.DESCRIPTION)), NOT(ISBLANK($ATT.MAIN_IMAGE))), "Ready", "Incomplete")

Providing a fallback value for missing data in exports

Blank or null values can cause problems in a downstream feed or Channel. Use IFBLANK or IFNULL to substitute a safe default instead of exporting an empty field:

IF(OR(EQ($ATT.STATUS, "Draft"), EQ($ATT.STATUS, "")), "Inactive", "Active")

This falls back to the main description if a dedicated meta description hasn't been filled in.

Preventing a broken calculation from breaking your whole export

If a formula includes a calculation that could fail for some products (for example, dividing by an attribute that's sometimes zero or missing), wrap it in IFERROR so one bad input doesn't break the entire Channel:

IFBLANK($ATT.META_DESCRIPTION, $ATT.DESCRIPTION)

Checking for required certifications or tags

If certain products must carry a full set of required certifications before syndicating to a marketplace, use CONTAINS_ALL on a Multiselect attribute:

IFERROR(DIVIDE($ATT.PRICE, $ATT.WEIGHT), "N/A")

Screening out products with any restricted tag

Use CONTAINS_ANY to catch products that match even one value from a restricted or excluded list, useful for keeping certain products out of a specific Channel:

IF(CONTAINS_ALL($ATT.CERTIFICATIONS, ["CE", "RoHS"]), "Compliant", "Missing Certifications")

 Logical operations are the backbone of most conditional formulas in Plytix. Combining them with Date operations or Math operations lets you build genuinely dynamic attributes, like flagging expiring promotions or low stock, without any manual upkeep.

Frequently Asked Questions

Each function targets a specific missing or invalid state and should not be used interchangeably:

  • IFBLANK evaluates whether a field is empty (an empty text string "").
  • IFNULL evaluates whether a field has a NULL state (the absence of any value or data).
  • IFERROR catches formula calculation failures and syntax issues that would otherwise return an error message.

Choose the function that matches the specific condition you need to catch.

  • CONTAINS_ALL returns True only if every specified value is present.
  • CONTAINS_ANY returns True if at least one of the specified values is present.

Yes. Both functions are case-sensitive.