Expressions always start with a functionedit

Expressions simply execute functions in a specific order, which produce some output value. That output can then be inserted into another function, and another after that, until it produces the output you need.

To use demo dataset available in Canvas to produce a table, run the following expression:

/* Simple demo table */
filters
| demodata
| table
| render

This expression starts out with the filters function, which provides the value of any time filters or dropdown filters in the workpad. This is then inserted into demodata, a function that returns exactly what you expect, demo data. Because the demodata function receives the filter information from the filters function before it, it applies those filters to reduce the set of data it returns. We call the output from the previous function context.

The filtered demo data becomes the context of the next function, table, which creates a table visualization from this data set. The table function isn’t strictly required, but by being explicit, you have the option of providing arguments to control things like the font used in the table. The output of the table function becomes the context of the render function. Like the table, the render function isn’t required either, but it allows access to other arguments, such as styling the border of the element or injecting custom CSS.

It is possible to add comments to the expression by starting them with a // sequence or by using /* and */ to enclose multi-line comments.