outer-join
Does a left outer join with SheetRight keyed on either the header names they have in common or the arguments, which come in pairs of first the left's header name and then the right's header name.
pebblestream:outer-join(SheetRight, [ ["Key Left", "Key Right",] ...])
For example, consider relating customers to their orders. Here is the Customer worksheet.
Customer ID | Name |
---|---|
0 | John |
1 | James |
2 | Alex |
3 | Linda |
And here is the Orders worksheet.
Order ID | Amount | Customer ID |
---|---|---|
0 | 5 | 0 |
1 | 1 | 0 |
2 | 8 | 2 |
3 | 6 | 1 |
4 | 2 | 7 |
And here is the Customers-Orders worksheet. We obtain this worksheet by placing the following directive in a comment on the Customer-Orders worksheet.
pebblestream:from(Customers)
pebblestream:outer-join(Orders)
Name | Customer ID | Order ID | |
---|---|---|---|
John | 0 | 0 | 5 |
John | 0 | 1 | 1 |
James | 1 | 3 | 0 |
Alex | 2 | 2 | 8 |
Linda | 3 |
In this next example, the user explicitly set the outer join criteria.
Here is the Transfers worksheet.
From | To | Amount |
---|---|---|
A0 | A1 | 24 |
A0 | A1 | 576 |
A2 | A1 | 13 |
A1 | A0 | 42 |
A3 | A0 | 78 |
And here is the Taxable worksheet.
Account From | Account To | Taxable |
---|---|---|
A0 | A1 | TRUE |
A0 | A2 | FALSE |
A1 | A0 | FALSE |
A1 | A2 | TRUE |
A2 | A0 | FALSE |
A2 | A1 | TRUE |
A1 | A3 | FALSE |
And here is the Transfers-Taxable worksheet. The user can create this worksheet using this directive declaration:
pebblestream:from(Transfers)
pebblestream:outer-join(Taxable, "From", "Account From", "To", "Account To")
Amount | From | To | |
---|---|---|---|
24 | A0 | A1 | TRUE |
576 | A0 | A1 | TRUE |
13 | A2 | A1 | TRUE |
42 | A1 | A0 | FALSE |
78 | A3 | A0 |
Updated over 2 years ago