AgileApps Support Wiki Pre Release

Difference between revisions of "Introduction to Expressions"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
An expression is any valid set of literals, variables and operators that evaluates to a single value, which is used to build Filter criteria or Formulas. The resulting value can be a number, a string, a date/time, or a Boolean (Logical: TRUE/FALSE).
An ''expression'' is any valid set of literals, variables and operators that evaluates to a single value.  


The simplest expressions are called primary expressions and refer to the value of a literal, variable, or formula function. These are examples of primary expressions:
An expression is used to build Filter criteria or a Formula.
 
Two different kinds expressions are used in the platform:
:* '''Filter Expressions'''
::* Used to select records.
::* The value of the expression is always a Boolean (true or false) value.
::* Expressions are created using fields, values, comparison operators, and logical operators.
::* Fields in the object record can be referenced.
::* Filter expressions do not include functions.
 
:* '''Formula Expressions'''
::* Used to return a value.
::* The resulting value can be a number, a string, a date/time, or a Boolean (Logical: TRUE/FALSE).
::* A wide variety of [[Formula Functions]] are available.<br>For example:
::: <tt>ROUND( amount * 0.02, 2)</tt> (rounds the variable to the nearest 2 decimal places)
::* Fields in the object record and in [[Lookup]] target records can be referenced, up to 5 levels deep.
::* Logical operations are performed using functions <tt>AND()</tt> and <tt>OR()</tt>
 
The simplest expression is a literal value, a variable, or a formula function:
:* <tt>972</tt> (a numeric literal)
:* <tt>972</tt> (a numeric literal)
:* <tt>'Steve'</tt> (a string literal)
:* <tt>'Steve'</tt> (a string literal)
Line 7: Line 25:
:* <tt>TODAY</tt> (a formula function that returns the current date)
:* <tt>TODAY</tt> (a formula function that returns the current date)


;Examples:
More complex expressions are created by combining values with operators. For example:
:*Primary expressions can be combined with operators--for example, to multiply a variable by a literal value:
::<tt>amount * 0.02</tt>
::<tt>amount * 0.02</tt>
:*[[Formula Functions]] can also be included in expressions. For example, to round the result of the previous expression to the nearest 2 decimal places:
::<tt>ROUND( amount * 0.02, 2)</tt>

Latest revision as of 01:11, 10 May 2014

An expression is any valid set of literals, variables and operators that evaluates to a single value.

An expression is used to build Filter criteria or a Formula.

Two different kinds expressions are used in the platform:

  • Filter Expressions
  • Used to select records.
  • The value of the expression is always a Boolean (true or false) value.
  • Expressions are created using fields, values, comparison operators, and logical operators.
  • Fields in the object record can be referenced.
  • Filter expressions do not include functions.
  • Formula Expressions
  • Used to return a value.
  • The resulting value can be a number, a string, a date/time, or a Boolean (Logical: TRUE/FALSE).
  • A wide variety of Formula Functions are available.
    For example:
ROUND( amount * 0.02, 2) (rounds the variable to the nearest 2 decimal places)
  • Fields in the object record and in Lookup target records can be referenced, up to 5 levels deep.
  • Logical operations are performed using functions AND() and OR()

The simplest expression is a literal value, a variable, or a formula function:

  • 972 (a numeric literal)
  • 'Steve' (a string literal)
  • creation_date (a variable value)
  • TODAY (a formula function that returns the current date)

More complex expressions are created by combining values with operators. For example:

amount * 0.02