Did you know...
You can write Conditional statements (also known as logical, ternary, true/false, or if then else statements) in the Math Expression Builder for database channels, grids, and voxels.
The expression format is
New = ( ) ? ( ) : ( )
where the "if" statement is before the question mark, the "then" statement is after the question mark, and the "else" statement is after the colon.
You can also nest these statements. For example, this statement fills in new values for a channel called NewZ when Depth is less than 0 and when Altm is greater than 1000.
NewZ = ((Depth <0 ? 0 : Altm > 1000) ? DUMMY : Z)
You'll find the shortcut in the Frequent tab under Operators and Functions in the Math Expression Builder for each document type:
- Databases (Database Tools > Channel Math...)
- Grid (Grids and Images > Grid Math...)
- Voxels (Voxel > Voxel Math...)
You can also use the Common Tasks to fill in an example True/False statement
Here are some more resources to check out:
- Math Expressions video
- How to write a true/false math expression statement
- or Search for "math expression" to find many other related resources