Skip to content

Commit

Permalink
zip
Browse files Browse the repository at this point in the history
  • Loading branch information
fscelliott committed Nov 22, 2024
1 parent 3568dda commit 4917d18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ Zips tables into rows, or zips tables, arrays, and sections as follows:
- If there are duplicate field keys when merging, the last-listed key in the `source_fields` array overwrites any preceding ones. For example, say you have source fields with output like the following:

```json
"item_colors": [ {"color": "blue", "ID": 123}, {"color": "red", "ID": 456}, ... ],
"item_sizes": [ {"size": "x-large", "ID": 789}, {"size": "small", "ID": 456} ... ]
"item_color": [ {"color": "blue", "ID": 123}, {"color": "red", "ID": 456}, ... ],
"item_size": [ {"size": "x-large", "ID": 789}, {"size": "small", "ID": 456} ... ]
```

If you zip with `"source_ids": ["item_color", "item_sizes"]`, then the first merged item is `[ {color: "blue", "ID": 789, "size": "x-large"}]`.
If you zip with `"source_ids": ["item_color", "item_size"]`, then the first merged item is `[ {color: "blue", "ID": 789, "size": "x-large"}]`.


If you zip with `"source_ids": ["item_sizes", "item_color"]`, then the first merged item is `[ {"color": "blue", "ID": 123, "size": "x-large"}]`.
If you zip with `"source_ids": ["item_size", "item_color"]`, then the first merged item is `[ {"color": "blue", "ID": 123, "size": "x-large"}]`.

Parameters
====
Expand Down Expand Up @@ -185,7 +185,7 @@ The following image shows the example document used with this example config:



## Example 2: Table zip
## Example 2: Zip table

The following example shows using the Zip method to transform each row from a table of vehicles into a vehicle object.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Advanced: Zip table sections

The following example shows zipping multiple tables together by treating each table as a section group and each row or column as a section.

**Note:** For an alternative to this example, see [Example 3: Zip tables](doc:zip).

As an overview, this example shows creating a `zipped_vehicle_description_and_coverages` array, where each object in the array contains information from the vehicles table and from the limitations table in the following image:

![Click to enlarge](https://raw.githubusercontent.com/sensible-hq/sensible-docs/main/readme-sync/assets/v0/images/final/vertical_sections_zip.png)
Expand Down

0 comments on commit 4917d18

Please sign in to comment.