Zip
Zips one of the following:
- Zips the output of array source fields into an array of objects. Each source field must output an array, for example, as a result of configuring
"match": "all"
or"type": "name"
for the field. - Zips the output of a single table method into row objects. Or, use this to zip multiple tables together.
- Zips the output of sections into an array of objects.
Parameters
The following parameters are in the computed field’s global Method parameter:
key | value | description |
---|---|---|
id (required) | zip | |
source_ids (required) | array of field IDs in the current config | One of the following: - the IDs of the source fields to zip. Each source field must output an array. - a single ID for a field that returns a table. Sensible returns an array of zipped row objects. - the IDs of the section groups to zip together. Sensible returns a zipped section group containing all the fields from the source section groups. If there are identically named field IDs in the source section groups, Sensible falls back to outputting the IDs in the last section group listed in the source_id array.Zips operate with the following precedence for source IDs: - If at least one source field is a section group, Sensible outputs the section group and ignores all other types of sources. - If at least one source is a table and there are no section group sources, Sensible outputs the first table ID and ignores all other sources. - If the output of the source IDs are arrays, the Zip method joins them up to their maximum shared length. For example, if you zip arrays that have 4, 5, and 6 elements respectively, the zipped array has 4 elements. Examples of source IDs that output arrays include fields with “match”: “all” configured, and section groups. To ensure the longest source array isn’t shortened when using “match”: “all”, instead use “match”:“allWithNull” for all source fields. For an example, see the Examples section. |
Examples
Sections zip
For an example of zipping sections together, see Zip sections example.
Table zip
The following example shows using the Zip method to extract each row from a table of vehicles as a vehicle object.
Notes:
- In order to filter out all column headings, the config specifies
"type": "number"
and"isRequired": true
for the columncol3_year_made
. - To improve performance, the config specifies a Stop parameter. This ensures Sensible restricts table recognition to the relevant page area.
Config
Example document
The following image shows the example document used with this example config:
Example document | Download link |
---|
Output
All With Null zip
The following example shows using "match":"allWithNull"
as an alternative to sections to return parallel arrays of phones and last names. If you used "match":"all"
instead of allWithNull
, the missing phone number for claimant Badawi would result in that claimant’s omission from the zipped name_and_phone
array.
Config
Example document
The following image shows the example document used with this example config:
Example document | Download link |
---|
Output