Skip to main content Skip to footer

Array Join Documentation

Version: 4.0.0
Retrieved: 2025-10-09 15:15:11


Array Join

The Array Join module combines messages arriving into an array of messages. It supports Time, Count, Mixed, Auto and PropertyChange modes.

Modes

The module supports five different modes.

  • Time
    • The module collects all messages received during a period of time. It then sends the messages to the next module(s) as an array.
  • Count
    • The module will collect n messages (regardless of the time it takes) and then pass the messages to the next module(s as an array.
  • Mixed
    • The module will combine time and count and when one of the criteria is full-filled it will pass the messages to the next module(s) as an array.
  • Auto
    • The module will use array information sent from a previous module in the flow (like Array Split). When all elements are received to the Array Join module it will pass the messages to the next module(s) as an array. To avoid stale arrays, the Time Window setting will be used as a timeout. If not all elements have been received within the Time Window range, the array will be sent out with allElementsIncluded=false
  • PropertyChange
    • The module will monitor a specified property in incoming messages and keep joining them while the property value remains the same. When the property value changes, it will send out the joined messages and restart the collection process with the new property value. To avoid stale arrays and infinitely large arrays, the Time Window setting will be used as a timeout. If the property doesn't change within the Time Window range, the array will be sent out and collection will restart.

Settings

Name Requirements Purpose Default
Source Property String 0-128 in length The property containing the data to collect  
Target Property String 1-128 in length The property to write the result into  
Mode Time, Count, Mixed, Auto, PropertyChange The mode to use Time
Count Number 1 or larger Used for Count/Mixed mode. The number of items to collect 100
Array Information Property String 0-64 in length. 1-64 if Auto Mode Used only for Auto mode.
The property with array information
array
Time window Number 1-86400000 Used for Auto/Mixed/Time/PropertyChange mode.
The time window for collecting data
1000
Add timestamp Boolean If checked the result will have a timestamp set for the data collection False
Add item timestamp Boolean If checked each item in the collection will have a timestamp False
Include count Boolean If checked the message will have a property showing how many items that the array contains False
Send empty collection Boolean If checked the module will pass an default message even if no data was collected during the Time Window False
Change Property String 0-128 in length Used for PropertyChange mode. The property name to monitor for changes.  

Example 1 - Time

The sample assumes that the modules receives 2 messages each second.

# Settings:
Mode = Time
Time window = 1000
Target Property = data
Add item timestamp = true

# Incoming messages:
// 1
{
  "temp": 84
}
// 2
{
  "temp": 82
}
// 3
{
  "temp": 45
}
// 4
{
  "temp": 74
}

# Outgoing message 1:
{
  "data": [
    {
      "timestamp": "2018-09-26T12:44:55.346562Z",
      "temp": 84
    },
    {
      "timestamp": "2018-09-26T12:44:55.718941Z",
      "temp": 82
    }
  ]
}

# Outgoing message 2:
{
  "data": [
    {
      "timestamp": "2018-09-26T12:44:56.239120Z",
      "temp": 45
    },
    {
      "timestamp": "2018-09-26T12:44:56.982301Z",
      "temp": 74
    }
  ]
}

Example 2 - Count

The sample assumes that the modules receives 5 messages. It will send out 3 messages and keep 2 until another one is received and the batch is completed.

# Settings:
Mode = Count
Count = 3
Target Property = data
Add item timestamp = true

# Incoming messages:
// 1
{
  "temp": 84
}
// 2
{
  "temp": 82
}
// 3
{
  "temp": 45
}
// 4
{
  "temp": 74
}
// 5
{
  "temp": 67
}

# Outgoing message:
{
  "data": [
    {
      "timestamp": "2018-09-26T12:44:55.346562Z",
      "temp": 84
    },
    {
      "timestamp": "2018-09-26T12:44:55.718941Z",
      "temp": 82
    },
    {
      "timestamp": "2018-09-26T12:44:56.239120Z",
      "temp": 45
    }
  ]
}

Example 3 - Mixed

The sample assumes that the modules receives 5 messages over 1.5 second. Since the count rule will be completed before the time window the module will pass an array with the 4 first messages. Both the counter and the timer will be reset after sending a message so that they are back to the initial state.

# Settings:
Mode = Mixed
Count = 4
Time window = 2000
Target Property = data

# Incoming messages:
// 1
{
  "temp": 84
}
// 2
{
  "temp": 82
}
// 3
{
  "temp": 45
}
// 4
{
  "temp": 74
}
// 5
{
  "temp": 67
}

# Outgoing message:
{
  "data": [
    {
      "temp": 84
    },
    {
      "temp": 82
    },
    {
      "temp": 45
    },
    {
      "temp": 74
    }
  ]
}

Example 4 - Auto

The sample assumes that the modules receives 5 messages. It will send out 3 elements and exclude 2 as they should not be part of the resulting array based on the input. Since the auto rule will be completed before the Time window the module will pass an array with the 3 elements. Also, for Auto mode, an extra property array will be added to the message containing properties of the resulting array.

# Settings:
Mode = Auto
Array Information Property = array
Time window = 2000
Target Property = data
Add item timestamp = true
Include count = true

# Incoming messages:
// 1
{
  "temp": 84,
  "array": {
    "arrayId": "4050baa0-4199-73d5-88a2-641c6de458f7",
    "indexOfElement": 0,
    "arrayLength": 5,
    "includeInJoin": true
  }
}
// 2
{
  "temp": 82,
  "array": {
    "arrayId": "4050baa0-4199-73d5-88a2-641c6de458f7",
    "indexOfElement": 1,
    "arrayLength": 5,
    "includeInJoin": false
  }
}
// 3
{
  "temp": 45,
  "array": {
    "arrayId": "4050baa0-4199-73d5-88a2-641c6de458f7",
    "indexOfElement": 2,
    "arrayLength": 5,
    "includeInJoin": true
  }
}
// 4
{
  "temp": 74,
  "array": {
    "arrayId": "4050baa0-4199-73d5-88a2-641c6de458f7",
    "indexOfElement": 3,
    "arrayLength": 5,
    "includeInJoin": false
  }
}
// 5
{
  "temp": 67,
  "array": {
    "arrayId": "4050baa0-4199-73d5-88a2-641c6de458f7",
    "indexOfElement": 4,
    "arrayLength": 5,
    "includeInJoin": true
  }
}

# Outgoing message:
{
  "data": [
    {
      "timestamp": "2021-02-26T12:44:55.346562Z",
      "temp": 84
    },
    {
      "timestamp": "2021-02-26T12:44:55.718941Z",
      "temp": 45
    },
    {
      "timestamp": "2021-02-26T12:44:56.239120Z",
      "temp": 67
    }
  ],
  "array": {
    "arrayId": "4050baa0-4199-73d5-88a2-641c6de458f7",
    "allElementsIncluded": false,
    "arrayLength": 3
  }
}

Example 5 - PropertyChange

The module monitors the specified property and joins messages until the property value changes. When a change is detected, it outputs the collected messages and starts a new collection.

# Settings:
Source Property = data
Mode = PropertyChange
Change Property = status
Time window = 2000
Target Property = data
Add item timestamp = true

# Incoming messages:
// 1
{
  "temp": 84,
  "status": "running"
}
// 2
{
  "temp": 82,
  "status": "running"
}
// 3
{
  "temp": 45,
  "status": "running"
}
// 4 - Status changes, triggers output
{
  "status": "stopped"
}

# Outgoing message 1 (triggered by status change):
{
  "data": [
    {
      "timestamp": "2018-09-26T12:44:55.346562Z",
      "temp": 84
    },
    {
      "timestamp": "2018-09-26T12:44:55.718941Z",
      "temp": 82
    },
    {
      "timestamp": "2018-09-26T12:44:56.239120Z",
      "temp": 45
    }
  ],
  "status": "stopped"
}

# The module now starts collecting again with the new status value "stopped"
// 5
{
  "temp": 67,
  "status": "stopped"
}
// 6 - Status changes again, triggers another output
{
  "temp": 55,
  "status": "error"
}

# Outgoing message 2 (triggered by status change to "error"):
{
  "data": [
    {
      "timestamp": "2018-09-26T12:44:56.982301Z",
      "temp": 67
    },
    {
      "timestamp": "2018-09-26T12:44:57.192845Z",
      "temp": 55
    }
  ],
  "status": "error"
}

# Note: If the property doesn't change within the Time Window (2000ms in this example),
# the collected messages will be sent out automatically to prevent stale/infinite arrays.