Table of Contents
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:
- Instances where the value of ProductPrice1 is less than 2 (shown in the statement above in red)
- 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
- ProductPrice1 is less than 2
- ProductPrice1 is greater than 2
- ProductHeight is greater than 20
- _AND field returns TRUE where ProductPrice1 is less than 2 AND ProductHeight is greater than 20
- _AND field returns FALSE where ProductPrice1 is greater than or equal to 2 AND ProductHeight is greater than 20
See also