Easy Insight Logo
Call 1-(720)-316-8174

Conditional Logic

case a case statement, also known as a switch statement, is used for conditional logic. A case or switch statement allows for selection control in order to allow the value of a variable or expression to change the control of flow of a program's execution via a conditional statement or multiway branch.

case([Field], "x", 1, "y", 2, 3)

would return 1 if Field is x, return 2 if Field is y, and 3 if anything else.

if

if for conditional logic

if([Field1] > [Field2], 1, 0)

will return 1 if the value of Field1 is greater than the value of Field2

if([Field1] >= [Field2], 1, 0)

will return 1 if the value of Field1 is greater than or equal to the value of Field2

if([Field1] == [Field2], 1, 0)

will return 1 if the value of Field1 is equal to the value of Field2

if([Field1] <= [Field2], 1, 0)

will return 1 if the value of Field1 is less than or equal to the value of Field2

if([Field1] < [Field2], 1, 0)

will return 1 if the value of Field1 is less than the value of Field2

if([Field1] != [Field2], 1, 0)

will return 1 if the value of Field1 is not equal to the value of Field2

if(([Field1] > [Field2]) && ([Field3] > [Field4]), 1, 0)

will return 1 if the value of Field1 is greater than the value of Field2 AND the value of Field3 is greater than the value of Field4

will return 1 if the value of Field1 is not equal to the value of Field2

if(([Field1] > [Field2]) || ([Field3] > [Field4]), 1, 0)

will return 1 if the value of Field1 is greater than the value of Field2 OR the value of Field3 is greater than the value of Field4

You can also do nested if statements, such as:

if ([Field1] < 5, 1, if ([Field1] < 10, 2, 3))

Will return 1 if Field1 is less than 5, 2 if Field1 is less than 10, and otherwise 3.

Twitter Logo