> Markdown versions of all pages of this connector library are available by appending `.md` to the page URL. For the full index of connectors, see [llms.txt](https://connectors.appmixer.com/llms.txt).

# appmixer.utils.controls.JoinEach

- Component: `appmixer.utils.controls.JoinEach`
- Kind: Action
- Version: 1.1.2
- Visibility: Public
- Connector: [appmixer.utils.controls 1.14.7](https://connectors.appmixer.com/connector/appmixer.utils.controls/1.14.7.md)
- Component page: <https://connectors.appmixer.com/connector/appmixer.utils.controls/1.14.7/component/appmixer.utils.controls.JoinEach>

This JoinEach can be used in combination with Each component. The 'count' port has to receive the total number of messages that the component will wait for on the 'in' port. When that number of messages arrives, it will send an object with an array containing all the input messages to it's output port.

## Input ports

### Port `in`

| Field | Type | Description |
| --- | --- | --- |
| Correlation ID (`correlationId`) | select | For every JoinEach there must be a source Each (or similar) component. JoinEach component needs the Correlation ID from the Each component to correctly join the input messages together. |

### Port `count`

| Field | Type | Description |
| --- | --- | --- |
| Number of input messages (`count`) | number | Number of input message this component will wait for. Usually, use the 'Items count' output property from the Each component's 'done' port. |
| Correlation ID (`correlationId`) | select | Set the Correlation ID to the same variable as you selected in the Correlation ID input field of the 'in' input port configuration. |
| Timeout (`timeout`) | toggle | A problem may occur in the flow and one or several messages may not arrive to the input port. The component will wait for specified number of seconds. After that it will send a message to the 'timedOut' port. That message will contain number of expected items, number of items that actually arrived and an array of items that arrived. |
| Timeout (seconds). (`timeoutValue`) | number | Timeout in seconds. A problem may occur in the flow and one or several messages may not arrive to the input port. The component will wait for specified number of seconds. After that it will send a message to the 'timedOut' port. That message will contain number of expected items, number of items that actually arrived and an array of items that arrived. |

## Output ports

### Port `out`

| Field | Type | Description |
| --- | --- | --- |
| Array of items (`items`) | - | - |

### Port `timeout`

| Field | Type | Description |
| --- | --- | --- |
| Array of items (`items`) | - | - |
| Expected number of items (`count`) | - | - |
| Number if items arrived (`arrived`) | - | - |

## Full metadata (component.json)

```json
{
  "name": "appmixer.utils.controls.JoinEach",
  "author": "Martin Krčmář <martin@client.io>",
  "description": "This JoinEach can be used in combination with Each component. The 'count' port has to receive the total number of messages that the component will wait for on the 'in' port. When that number of messages arrives, it will send an object with an array containing all the input messages to it's output port.",
  "private": false,
  "version": "1.1.2",
  "outPorts": [
    {
      "name": "out",
      "options": [
        {
          "label": "Array of items",
          "value": "items"
        }
      ]
    },
    {
      "name": "timeout",
      "options": [
        {
          "label": "Array of items",
          "value": "items"
        },
        {
          "label": "Expected number of items",
          "value": "count"
        },
        {
          "label": "Number if items arrived",
          "value": "arrived"
        }
      ]
    }
  ],
  "inPorts": [
    {
      "name": "in",
      "schema": {
        "type": "object",
        "properties": {
          "correlationId": {
            "type": "string"
          }
        }
      },
      "inspector": {
        "inputs": {
          "correlationId": {
            "type": "select",
            "tooltip": "For every JoinEach there must be a source Each (or similar) component. JoinEach component needs the Correlation ID from the Each component to correctly join the input messages together.",
            "label": "Correlation ID",
            "index": 1
          }
        }
      }
    },
    {
      "name": "count",
      "schema": {
        "type": "object",
        "properties": {
          "count": {
            "type": "number"
          },
          "timeout": {
            "type": "boolean"
          },
          "timeoutValue": {
            "type": "integer",
            "minimum": 60
          },
          "correlationId": {
            "type": "string"
          }
        },
        "required": [
          "count"
        ]
      },
      "inspector": {
        "inputs": {
          "count": {
            "type": "number",
            "tooltip": "Number of input message this component will wait for. Usually, use the 'Items count' output property from the Each component's 'done' port.",
            "label": "Number of input messages",
            "index": 1
          },
          "correlationId": {
            "type": "select",
            "tooltip": "Set the Correlation ID to the same variable as you selected in the Correlation ID input field of the 'in' input port configuration.",
            "label": "Correlation ID",
            "index": 2
          },
          "timeout": {
            "type": "toggle",
            "tooltip": "A problem may occur in the flow and one or several messages may not arrive to the input port. The component will wait for specified number of seconds. After that it will send a message to the 'timedOut' port. That message will contain number of expected items, number of items that actually arrived and an array of items that arrived.",
            "defaultValue": true,
            "label": "Timeout",
            "index": 3
          },
          "timeoutValue": {
            "type": "number",
            "label": "Timeout (seconds).",
            "defaultValue": 300,
            "tooltip": "Timeout in seconds. A problem may occur in the flow and one or several messages may not arrive to the input port. The component will wait for specified number of seconds. After that it will send a message to the 'timedOut' port. That message will contain number of expected items, number of items that actually arrived and an array of items that arrived.",
            "when": {
              "eq": {
                "timeout": true
              }
            },
            "index": 4
          }
        }
      }
    }
  ],
  "icon": "(data URI omitted)"
}
```
