Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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 large set of built-in functions known as the ExpressionEngineFunctions. You can navigate to official C3 documentation regarding ExpressionEngineFunctions here:,

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

Ternary Operators

Ternary operators specify a conditional expression, and then two values to return depending on the falsity of the conditional expression. The format is:

<expression> ? <value_if_true> : <value_if_false>

Useful references

Sometimes, it may be useful for a timeseries to refer to itself, or to get a reference to the 'current' timeseries. This is done with the this name. For example, we can specify the transform field of a TsDecl metric to do some transformation of the data before it heads to normalization. We can use the fillMissing function to fill gaps in the data with a specified value. We'd specify this with fillMissing(this, <value_to_fill>).

Useful functions

The following functions are useful in general, and also come up during tutorials.


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


window computes an aggregation over a series of intervals in a moving window along the input timeseries. It takes an aggregation function, a timeseries (which will be aggregated), and variables defining the window including window width and offset.


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


fillMissing will impute missing values with some default value you specify. This is useful if you want to indicate missing values in some special way.


identity takes a value, and simply repeats this value when building the timeseries. it's useful occasionally if you need a timeseries consisting entirely of one value.

  • No labels