Logic/Conditions

AND – Test if all arguments are true

362 views June 1, 2018 February 26, 2019 admin 0

Overview

This Custom Field returns TRUE if all arguments are TRUE; It returns FALSE if any argument is FALSE. An AND statement can have a large number of arguments.

Syntax

AND(Argument1, Argument2, Argument3)

Element Description
Argument1 The first argument to be tested.
Argument2 The second argument to be tested.
Argument3 The third argument to be tested (if required).

Application

Using the AND function allows you to control the display of items based on multiple criteria, e.g.:

  • Displaying an icon in cases where items must be purchased in pack lots and the item is a stock item (not a special order).
  • Displaying an address, web address or phone number in a directory where a privacy flag is set and the listing has paid for a particular listing type.

Worked Example

The following example shows how the AND function may be used in the context of a catalog:

Syntax

AND(IF(FIELDSTR(ProductPrice1), ‘<‘, 2), IF(FIELDSTR(ProductHeight), ‘>’, ’20’))

Explanation

In this example, the AND statement is testing for two separate conditions:

  1. Instances where the value of ProductPrice1 is less than 2 (shown in the statement above in red)
  2. Instances where the value of ProductHeight is greater than 20 (blue)

If both these conditions are met then the value TRUE is returned, otherwise FALSE is returned.

Panel view

  1. ProductPrice1 is less than 2
  2. ProductPrice1 is greater than 2
  3. ProductHeight is greater than 20
  4. _AND field returns TRUE where ProductPrice1 is less than 2 AND ProductHeight is greater than 20
  5. _AND field returns FALSE where ProductPrice1 is greater than or equal to 2 AND ProductHeight is greater than 20

See also

 

Was this helpful?