younifyd
Menu

Aggregate Data

Filter, group and total CSV, JSON or XML data: sum, average, min, max, count and more, by one or several fields

Use it in a workflow

  1. Add a step and choose the Data Converter connector.
  2. Pick the Aggregate Data action (under helper).
  3. Fill in the fields below, then reference the result from later steps as {{aggregateData.response.data}}.

Fields

contentstringrequired

The CSV, JSON or XML to aggregate, as text or data from a previous step, e.g. {{downloadFile.response.data.content}}.

formatstring

Detected automatically when set to Auto.

One ofautocsvjsonxmlDefault "auto"

inputEncodingstring

Choose base64 for content from the FTP, SFTP or File connectors.

One oftextbase64Default "text"

recordPathstring

Where the list of rows is, e.g. data.items or Orders.Order. Can be left empty when the data is a list.

csvDelimiterstring

The column separator, for CSV content.

Default ","

filtersarray<object>

Keep only the rows that match, before grouping. Leave empty to use every row.

fieldstringrequired

e.g. status or customer.region

operatorstringrequired

One ofeqnegtgteltltecontainsstartsWithendsWithinnotInexistsnotExistsDefault "eq"

valuestring

For in / notIn, separate values with commas. Not used by exists / notExists.

filterModestring

all: a row must pass every filter. any: passing one is enough.

One ofallanyDefault "all"

groupBystring

One or more fields, comma-separated, e.g. region,category. Leave empty for a single total over all rows.

aggregationsarray<object>

What to calculate for each group.

fieldstring

Not needed for count of rows.

opstringrequired

One ofsumavgminmaxcountcountDistinctmedianfirstlastDefault "sum"

asstring

Defaults to e.g. sum_amount.

includeRowsboolean

Add a rows list to every group with the original rows. Always on when there are no aggregations.

Default false

sortBystring

A group field or an aggregation name from the result. Keeps first-seen order when empty.

sortOrderstring

One ofascdescDefault "asc"

decimalsnumber

Round sums, averages and medians. Left empty, results are only cleaned of floating-point noise.

outputFormatstring

One ofjsoncsvDefault "json"

returnAsstring

value: data you can reference field by field. text: the result as text. base64: for uploading with FTP, SFTP or File.

One ofvaluetextbase64Default "value"

Examples

Sales by region

Total and average paid order value per region and category

json
{
  "content": "{{downloadFile.response.data.content}}",
  "inputEncoding": "base64",
  "filters": [
    {
      "field": "status",
      "operator": "eq",
      "value": "paid"
    }
  ],
  "groupBy": "region,category",
  "aggregations": [
    {
      "field": "amount",
      "op": "sum",
      "as": "totalSales"
    },
    {
      "field": "amount",
      "op": "avg",
      "as": "averageOrder"
    },
    {
      "op": "count",
      "as": "orders"
    }
  ],
  "sortBy": "totalSales",
  "sortOrder": "desc"
}

Rows grouped by purchase order

One group per purchase order, each with its rows, to process an order's lines together

json
{
  "content": "{{downloadFile.response.data.content}}",
  "inputEncoding": "base64",
  "groupBy": "poNumber"
}

Need more? See the Data Converter guide for connection setup and behaviour shared by every action.

Was this page helpful?