group by

This block is part of the array group and was last modified in core v10.4.28.

group by v10.4.28

Groups the elements of the given array by a specified field.

In pins 2
  • Array required
    array

    The array of objects to be grouped.

  • field required
    value

    The field based on which to group the objects.

Out pins 1
  • Array
    array

    An array of objects representing groups, where each group has properties "group" (the grouping value) and "items" (an array of items in that group).

Groups items by the TEXT of the given field's value into objects of shape {group, items, count}, ordered by first appearance of each group value. Non-object items and items lacking the field fall into a group named "none". field defaults to "group" when unwired.

A typical wiring for group by: map feeds the array pin; value feeds the field pin; the array out pin feeds sort array by field.

Studio canvas example for the group by block: typical wiring for group by.

Commonly used with

In production blueprints, this block is most often wired together with:

  • map: feeds into this block. Creates a new array with the results of the provided function on every element in the array.
  • sort array by field: this block feeds into it. Sorts the elements of an array by a given key.
  • value: feeds into this block. Simply returns the provided value.

Version history

Introduced in v10.4.28.


Back to array Return to the main group to view all sub-groups Back to array Return to the group to view all blocks within this group