C3 includes an expression evaluation system to make it eas= y to build simple functions. Essentially, they are one-line Ja= va expressions.

C3 Expressions are used all over the C3 AI Suite.

- Filter fields
- Projection expressions
- Data Transforms
- Dataset Processing
- Timeseries Metric expressions
- etc...

The C3 AI Suite supports a java-like expression syntax allowing the user= to define complex functions quickly and easily throughout the Suite. This = pseudo-language supports basic arithmetic and boolean operators as well a l= arge set of built-in functions known as the ExpressionEngineFunctions.

Here are some useful techniques and syntax which is available in C3 Expr= essions, but which may not be easy to find in current documentation

**Comparisons**- Expressions like a > b, c >=3D d which return boolean values

**Ternary Operators**which return a value based on the re= sult of a boolean expression- <conditional_expression> ? <value_if_true> : <value_if_f= alse>

**Java basic math operators**- Addition ( + )
- Subtraction ( - )
- Multiplication ( * )
- Division ( / )
- Modulus ( % )
- etc...

**Java Standard Libraries and Functions**- Ex: Math - Math.abs, Math.cos, etc...
- Type casting - ex. dateTime('2020-01-01')

**ExpressionEngineFunctions (C3 defined functions)**- rolling(aggFunc, input_series, ...) - Computes a rolling aggregation of= the input timeseries
- identity(value) - Produces a new timeseries consisting of repeating ent= ries of 'value'.
- eval(aggFunc, interval, input_series, ...) - Forces evaluation of the i= nput timeseries at the set interval, and aggregation with aggFunc.
- Most ExpressionEngineFunctions are designed to work with timeseries dat= a

`this`

Sometimes, it may be useful for a timeseries to refer to itself, or to g=
et a reference to the 'current' timeseries. This is done with the this name=
. For example, we can specify the `transform`

field of a ```
T=
sDecl
```

metric to do some transformation of the data before it heads t=
o normalization. We can use the `fillMissing`

function to fill g=
aps in the data with a specified value. We'd specify this with ```
fillMi=
ssing(this, <value_to_fill>)
```

.

Ternary Operators are widely useful throughout the C3 AI Suite. Th= ey allow small conditional expressions which can affect the return value of= your expression.

- rolling
- computes a rolling aggregation over a timeseries. It takes an agg= regation function, a timeseries (which will be aggregated), and possibly an= other timeseries to signal when to restart the aggregation. rolling is like= an expanding window function which may be dynamically reset.

- identity
- takes a value, and simply repeats this value when building the ti= meseries. it's useful occasionally if you need a timeseries consisting enti= rely of one value.

- eval
- generates a timeseries using a specific start/end date. This is u= seful for generating timeseries that rely on window functions which may rel= y on values before the start date of a requested timeseries. Essentially, e= val builds an entire timeseries which is passed to the next function or on = to the next step in the normalization process.

- rollingdiff
- returns a time series in which every value is computed by taking = the difference between current and previous point.

- fillMissing
- Will impute missing values with some default value you specify. T= his is useful if you want to indicate missing values in some special way.

- General topic page: https://developer.c3.ai/docs/7.19.0/topic/metr= ics-expression-engine-functions-home
- A list of ExpressionEngineFunctions is available
- Online: = https://developer.c3.ai/docs/7.19.0/type/ExpressionEngineFunction
- Through the Static Console: c3ShowType(ExpressionEng= ineFunction)