Transformative Directives

Directives that transform or combine worksheets into other worksheets.

Transformative directives look something like this:

pebblestream:from(Accounts)
pebblestream:filter("Amount", ">=0")
pebblestream:group-sum("Account ID", "Amount")

This transformation grabs all rows in the Accounts worksheet with a positive amount. It then adds all of these positive amounts for each Account ID. Finally, it creates one row for each Account ID in Accounts, where each Amount column has a total of each Account ID's positive amounts.

πŸ“˜

Transformative directives are typically placed in the top left corner of the worksheet.

By convention, Pebblers will place this directive in a worksheet cell's comment in the top-left cell (A1 or R1C1) of the worksheet.

A critical feature of transformative directives is that Pebblers may combine directives to perform more complicated operations. The runtime interprets Pebble Stream directives in a specific way to ensure optimal performance. Computer scientists call this declarative interpretation. No matter the order the Pebbler specifies, the directives in Pebble Script, the runtime will execute it in the same order.

For instance, the following Pebble Script declarations will produce the same result.

pebblestream:from("Orders")
pebblestream:filter("Active")
pebblestream:group-sum("Date","Amount")
pebblestream:group-sum("Date","Amount")
pebblestream:filter("Active")
pebblestream:from("Orders")
pebblestream:group-sum("Date","Amount")
pebblestream:from("Orders")
pebblestream:filter("Active")

Here is the order in which the runtime will execute transformative directives.

from
cartesian-product
join
outer-join
filter
sort
group
    coalesce
    sum
    ratio
    mult
    equal
    regex
group-unique
group-sum
group-ratio
header-map
split

πŸ“˜

Directive Compatability

Note that not all directives are combinable. See each directive's documentation entry to learn more about compatability.A critical