The following example demonstrates an ifstatement using a Dynamic Data Key. This allows us to highlight different values or ranges contextually, making important values stand out.
Assuming a key named "myValue" has been created, and contains a numerical value, we can use the following syntax:
#If the value of the "myValue" key is greater than 5, a blue color will be returned. Otherwise, a green color will be used. @myValue>5?"blue":"green"@ 
In the image below, the Fill property is also using a dynamic data key, so the Fill Color will be disabled if myValue is less than 1, Blue if myValue is between 1 and 4, and Green if greater or equal to 5. Note that in the Property inspector, the @ symbols are not needed.
To add more colorvalue pairs, we simply add more if statements to the end of the expression with a colon:
#If the value of "myValue" will determine one of multiple colors: #Greater than 10 will return Red #greater than 5 (but not greater than 10) will return Blue #anything else will return Green. @myValue>10?"red":myValue>5?"blue":"green"@ 
The following operators may be used in a Keychain expression.
Operator  Function  Example 

Parenthesis  (expr) Nested expressions  Any portion of a Key Chain can be enclosed with parenthesis to guarantee precedence. 
Multiplicative  *, /, % Multiply, divide, modulo  These are the most common and intuitive operators. You might want to display @quantity*price@ in an invoice lineitem or calculate a percent like this @profit/revenue*100@. 
Additive  +,  Add, subtract  See multiplicative above 
Relational  >, <, >=, <= Greaterthan, lessthan, greater/lessthanequal  These are most useful for conditionals: @amount>=0? "Credit" : "Debit"@ or @name=="this"? "that" : name@ 
Equality  ==, != Equal, notequal  See Relational above 
Logical  AND &&  These operators make it possible to test multiple conditions: @revenue>100 && budget<50? "Winner!"@ or @name=="Jack"  name=="Sam"? "Good Name!"@. 
Logical  OR   See and above 
Conditional  ? : If/then  with form "expr? true_expr : false_expr"  Provides IF/THEN/ELSE expressions. Note: a false expression is optional. 'null' will be evaluated to false and nonnull as true. You can provide null substitutions like this: @name? name : "(None provided)"@. You can also nest conditionals for more conditions. For example, @age>=21?"Adult":(age>12?"Teen":"Child")@. 
Assignments  =, +=  For the brave, you can create temporary variables for use in a report. Most of the functionality you might use this for is covered in more intuitive ways (such as the Running key), but it is possible to define a variable in a header row: @revTotal=0@ and update it in details rows @revTotal+=revenue@. 
The following functions return floats.
Menu Item  Function 

floor(float)  Round input down to the nearest whole number. 
ceil(float)  Round input up to the nearest whole number. 
round(float)  Round input to the nearest whole number. 
abs(float)  Returns the absolute value of the input (if number < 0 return number * 1). 
min(float, float)  Returns the input number with the least value. 
max(float, float)  Returns the input number with the greatest value. 
pow(float, float)  Returns first number to the second number power. 
The following functions return strings.
Menu Item  Function 

startsWith(String, String)  Returns true if the first string starts with the second. 
endsWith(String, String)  Returns true if the first string ends with the second. 
substring(String, int start)  Returns a substring of String beginning at position start. 
join(List aList, String aKeyChain, String aDelimeter)  Used to display an individual attribute of individual objects as a single String. Suppose you have a list of movies and want to show their titles in a comma separated list: @join(getMovies, "getTitle", ", ")@ 
substring(Object aString, int start, int end)  Obtain a subset of a given string. This could be useful if you wanted to restrict a text field to a certain number of chars:@substring(title, 0, 10)@ 
