Skip to content

Documentation

Transforming an Export with Code

The standard mode covers field selection, renaming, types, and nesting. If you need filtering, grouping, calculations, or a different overall structure, switch to Code transformation. This requires permission to manage exports and edit scenarios.

Two processing modes

Mode Purpose Restriction
Records Change each record's values Preserve the number and order of records
Dataset Group, filter, calculate totals, or change the number of objects Up to 10,000 input records and 16 MB

The code receives records after field mapping. The SDK export transformation guide explains how to read and return them.

Code runs in a sandbox without network or file access. A single call is limited to 30 seconds. Exceeding the dataset size stops the operation with an error; the result is not silently truncated.

Checking and saving

Click Save mode and code, then Test with data. The test button may save current changes first. The test uses the first five records. Execution time, including testing, counts toward the subscription's compute usage; AI use is counted separately.

For files and Webhook, dataset mode processes the entire permitted selection. For an endpoint, it processes only the current response page. A total for one page is therefore not a total for the catalog. Do not sum page averages without accounting for page sizes. For a global total, use a dataset transformation for a complete file or Webhook delivery.

Returning to standard mode

Switching to standard mode disables the transformation after you save. The code and its version remain. Check the result again after changing modes: its shape may change. Concurrent editing in another tab may cause a version conflict; reload the current version before saving again.

Python and other languages

The transformation editor supports PHP, JavaScript, TypeScript, and Python independently of collection language. Save new source when changing languages. Python uses def run(ctx):, reads ctx.params().get("items", []), and emits dictionaries with ctx.emit(). Return values do not become export records. See the complete Python transformation reference. The existing PHP examples on this page retain PHP syntax.

The logical dataset cap is 16 MiB, but each serialized input/output message must also fit the 12 MiB transport limit including metadata. Effective capacity may therefore be lower. If the payload limit is reached, narrow the selection or reduce large fields; the system reports an error rather than truncating data.