join

Use the join directive to merge rows from two worksheets based on criteria.

The join directive executes an inner join with the "from" worksheet keyed on either the header names they have in common or the arguments, which come in pairs of first the "from" worksheet's header name and then the join worksheet's header name.

Joining worksheets can be used as a powerful alternative to searching. Users can quickly pair two related rows in two different worksheets into a single row in another worksheet.

πŸ“˜

Joining worksheets can make the processing of related rows in each worksheet simpler and easier to understand.

Implicit Join example

Consider the following worksheet, Customer and Orders. Here is the Customers worksheet.

Customer IDName
0John
1James
2Alex

And here is the Orders worksheet.

Order IDAmountCustomer ID
050
110
282
361

Make the CustomerOrders worksheet with this directive declaration:

pebblestream:from(Customers)
pebblestream:join(Orders)

πŸ“˜

Note: The join criteria is automatically created when it is not explicitly specified.

In this case, Pebble Stream will assume that the common column named Customer ID is the basis of the join. The joined rows are those that have matching Customer IDs.

NameCustomer IDOrder IDAmount
John005
John011
James136
Alex228

Explicit Join Example

In this next example, we will explicitly join these two worksheets, Transfers and Taxable, using the criteria we explicitly choose.

Here is the Transfers worksheet.

FromToAmount
A0A124
A0A1576
A2A113
A1A042

And here is the Taxable worksheet.

Account FromAccount ToTaxable
A0A1TRUE
A0A2FALSE
A1A0FALSE
A1A2TRUE
A2A0FALSE
A2A1TRUE

Finally, we obtain Transfers-Taxable by joining the two worksheets using two criteria we explicitly choose.

pebblestream:from(Transfers)
pebblestream:join(Taxable, "From", "Account From", "To", "Account To")

In this case we join the two worksheets, wherever the From equals the Account From and the To equals the Account To.

AmountFromTo
24A0A1TRUE
576A0A1TRUE
13A2A1TRUE
42A1A0FALSE