OR (||)

The following section describes the syntax and usage of the OR (||) function in ActivityInfo.

Description

The OR (||) function is used to determine whether one or both conditions in a test are true. 

Multiple OR functions can be chained together to test whether one or more conditions in a set of conditions are true.

Syntax

condition1 || condition2

Argument Required Description
condition1 Yes The first condition you wish to test.

The condition must evaluate to TRUE or FALSE.
condition2 Yes The second condition you wish to test.

The condition must evaluate to TRUE or FALSE.

Result

  • TRUE if one or both conditions evaluate to TRUE.
  • FALSE if neither condition evaluates to FALSE.
  • NA if either condition is not a logical value (TRUE/FALSE).

Example

1. Basic Use

We will be using the OR function to evaluate two conditions, and using the IF function to return a value.

Arguments

We will be using the Multiple Selection Field "Against what have you been vaccinated?" with Field code "VAC".

Formula

IF(VAC.Measles || VAC.Mumps,1,0)

Results

2. Multiple Conditions

We will be using the OR function to evaluate a set of three conditions, and using the IF function to return a value.

Arguments

We will be using the Multiple Selection Field "Against what have you been vaccinated?" with Field code "VAC".

Formula

IF(VAC.Measles ||  VAC.Mumps || VAC.Rubella,1,0)

Results

Add a Number or a Quantity field (e.g. with Code "Q") to the result:

IF(VAC.Measles ||  VAC.Mumps || VAC.Rubella,1,0) + Q