Skip to main content Skip to footer

Array Sort by Property Documentation

Version: 1.0.1
Retrieved: 2025-10-09 15:15:13


Array Sort By Property

The module sorts and filters an array of objects by the specified Sort Property. Default sort order is ascending. If an object in the array is missing the Sort Property the object will be ignored and not included in the output. If the data type of the Sort Property is inconsistent in the array, no sorting will be done and the input value will passthrough the module.

Possible errors

If the value of the Source Property is not an array or if the type of the Sort Property is inconsistent in the array, the module will warn and output messages will have an error status.

Settings

Name Requirements Purpose Default
Source Property String 1-64 in length The property containing the array to convert data
Target Property String 1-64 in length The property to write the object into data
Sort Property String 1-64 in length The property that the array will be sorted by property name
Descending boolean Sort array in descending order false

Example

# Settings:
Source property = data
Target property = data
Sort property = name
Descending  = false

# Incoming messages:
{
    'data':[
        {name:'machineId', value:4126334, time:'12:03:23'},
        {name:'temp', value: 34.7, time:'12:03:20'},
        {id: 23, value: 12700, time:'12:03:26'},
        {name:'rpm', value: 12700, time:'12:03:26'},
        {name:'qlt', value: 24, time:'12:03:12'},
    ]
}

# Outgoing messages:
# Sorted ascending according to the name property
{
    'data':[
        {name:'machineId', value:4126334, time:'12:03:23'},
        {name:'qlt', value: 24, time:'12:03:12'},
        {name:'rpm', value: 12700, time:'12:03:26'},
        {name:'temp', value: 34.7, time:'12:03:20'},

    ]
}

Note that the object missing the name property is ignored and not included in the output.