Skip to main content

COMPARE

Compares the values of two strings and returns a logical response of true or false.

Syntax

bool COMPARE(string a, string b)
bool COMPARE(string a, string b, bool ignoreCase)

Example

You may want to compare two columns to see if they are the same, for example a Status column being compared to a WorkflowStatus column:

COMPARE(Status, WorkflowStatus)

Another example would be to compare Product Names to Product Sold.

COMPARE(ProductName,ProductSold)

Where if the ProductName is the same as the ProductSold then the function will return true, if they are not the same then false will be returned.


Alternatively you may want to compare a column to a specific string value, such as an employee status column Status to the string value Employed

AND(COMPARE(Status, "Employed"))

If you want this to be case sensitive you can add in false to not ignore case, by default COMPARE will ignore case.

AND(COMPARE(Status, "Employed", false))

This will only return true if the Status value is Employed, if it is employed it will return false.


Another option is to compare static string values:

COMPARE("Apples", "apples", false)

This will return 'False', as they are not of the same case.

or

COMPARE("Apples", "apples", true)

Returns true as the case has been ignored.