Skip to main content

Logical Commands

AND
IF
NOT
OR


AND

if values are numbers: returns 1 if both values are not zero, otherwise returns 0. If using text then it is assumed that you are referring to labels and the return result will be instances from the timeline that contain both labels. "AND" is commonly used inside other commands (see IF, COUNT...) and can be combined with "OR" and "NOT"

Format: labels AND labels OR number AND number

Arguments: labels: quoted text representing labels in the timeline number: numerical expression

Available: Available for all windows Version: 9 and later

Example:

In this example: $a="block" and "spike"

show count $a
Shows the number of instances with labels "block" and "spike" in them

show count not ("a" or "b" and "c")
Counts the number of instances that do not have "a" or have "b" and "c" as labels in them. AND will be calculated first before the OR as it has higher priority. Use brackets to force logic.


IF

Executes the statement based on a condition

Format: IF (condition, true statement, false statement) OR IF (condition,true statement)

Arguments: condition: if this numeric value is 0 it is considered false and will execute the false statement otherwise any nonzero result is considered true and will execute the true statement. You can use any relational operators =,=,!= on numbers or quoted text and logical operators AND, OR, NOT on numbers. When an empty string is compared to a number with = or !=, the string will be consdiered as 0. statement: any normal command including another "IF"

Available: Available for all windows Version: 9 and later

Example:

if (5 shows true. You can change the result by changing the condition to 6

In this example: $a=cell(1,0)

if ($a
Shows whether cell in column 1, row 0 is positive or negative number

if ($a!=0, show 5/$a, show "N/A")
Shows 5 divided by the contents of cell in column 1, row 0. If that cell is 0 or blank then show "N/A"

if ("tom" < "tot" and 4 shows true if ("tom" < "tot" and 6
Will do nothing as the condition is false and there is no false statement


NOT

if value is number: returns 1 if value is 0, otherwise returns 0. If using text then it is assumed that you are referring to labels and the return result will be instances from the timeline that do not contain the label. "NOT" is commonly used inside other commands (see IF, COUNT...) and can be combined with "AND" and "OR"

Format: NOT labels OR NOT number

Arguments: labels: quoted text representing instances labels in the timeline number: numerical expression

Available: Available for all windows Version: 9 and later

Example:

In this example: $a=not "spike"

show count $a
Shows the number of instances which do not have "spike" in them

show count not ("a" or "b" and "c")
Counts the number of instances that do not have "a" or have "b" and "c" as labels in them. AND will be calculated first before the OR as it has higher priority. Use brackets to force logic.


OR

if values are numbers: returns 1 if either value is not zero, otherwise returns 0. If using text then it is assumed that you are referring to labels and the return result will be instances from the timeline that contain either label. "OR" is commonly used inside other commands (see IF, COUNT...) and can be combined with "AND" and "NOT"

Format: labels OR labels OR number OR number

Arguments: labels: quoted text representing labels in the timeline number: numerical expression

Available: Available for all windows Version: 9 and later

Example

In this example: $a="block" or "spike"

show count $a
Shows the number of instances with either "block" or "spike" in them

show count not ("a" or "b" and "c")
Counts the number of instances that do not have "a" or have "b" and "c" as labels in them. AND will be calulated first before the OR as it has higher priority. Use brackets to force logic.