These block helpers allow for querying, filtering, and comparing objects.
- Helpers.Object.Compare
- Helpers.Object.Distinct
- Helpers.Object.DistinctBy
- Helpers.Object.Filter
- Helpers.Object.IsFirst
- Helpers.Object.IsLast
- Helpers.Object.Lookup
- Helpers.Object.OrderBy
- Helpers.Object.OrderByDescending
- Helpers.Object.Page
- Helpers.Object.Reverse
- Helpers.Object.Select
- Helpers.Object.Skip
- Helpers.Object.Sort
- Helpers.Object.Take
| Summary | Compare two objects |
| Returns | Whether or not operation evaluates successfully |
| Remarks | When trying to do a numeric comparison, if both inputs are not numeric a string comparison will occur. |
| Parameters | |
| lvalue | Left object |
| operatorType | Operator to perform, if not specified will default to =. Supported operators are =, !=, <, <=, >, >= |
| rvalue | Right object |
Context
{
"a": 0,
"b": 10
}Usage
Returns
<strong>result:</strong>
<strong>False</strong>
<strong>True</strong>
<strong>False</strong>| Summary | Return a collection of distinct elements from an array |
| Returns | Updated collection of distinct elements |
| Remarks | If object is not an array, this will drop into the else block. Note: this can be used with an array of maps/objects, it does not need to be an array of simple types(string, numeric, bool, etc..) |
| Parameters | |
| array | Array of objects to make distinct |
Context
{
"array": [
"one",
"two",
"two",
"two",
"three"
],
"badInput": {
"something": true
}
}Usage
Returns
<strong>result:</strong>
<strong>True</strong>
<ul>
<li>Value: one</li>
<li>Value: two</li>
<li>Value: three</li>
</ul>
<strong>False</strong>| Summary | Return a collection of distinct properties from an array |
| Returns | Updated collection of distinct elements |
| Remarks | If input is not an array, this will drop into the else block. Note: this can be used with an array of maps/objects, it does not need to be an array of simple types(string, numeric, bool, etc..) |
| If property is not found, this will return an empty array | |
| If property exists in some elements, but not others, this will return only those elements that contain the property | |
| Parameters | |
| input | Array of objects to make distinct |
| property | Property to match on |
Context
{
"array": [
{
"id": 1,
"name": "test1",
"type": {
"id": 5,
"name": "type1"
}
},
{
"id": 2,
"name": "test2",
"type": {
"id": 5,
"name": "type1",
"color": "blue"
}
},
{
"id": 3,
"name": "test2",
"type": {
"id": 6,
"name": "type2",
"color": "red"
}
},
{
"id": 4,
"name": "test3",
"type": {
"id": 7,
"name": "type3",
"color": "red"
}
}
],
"notArray": {
"id": 1
}
}Usage
Returns
<strong>Direct Property:</strong>
<strong>True</strong>
<ul>
<li>Value: test1</li>
<li>Value: test2</li>
<li>Value: test3</li>
</ul>
<strong>Nested Property:</strong>
<strong>True</strong>
<ul>
<li>Value: 5</li>
<li>Value: 6</li>
<li>Value: 7</li>
</ul>
<strong>Property Doesen't Exist:</strong>
<strong>True</strong>
<ul>
</ul>
<strong>Property Exists in Some Elements:</strong>
<strong>True</strong>
<ul>
<li>Value: 2</li>
<li>Value: 3</li>
</ul>
<strong>Input Not an Array:</strong>
<strong>False</strong>| Summary | Filters an array of objects given some expression |
| Returns | Array of matching objects |
| Remarks | |
| Parameters | |
| input | Array to filter |
| expression | Expression to filter by |
| ignoreCase | Whether or not to ignore case, defaults to false |
Context
{
"objects": [
{
"id": 1,
"name": "test-1",
"type": "thing",
"moreData": "more",
"meta": {
"name": "data"
}
},
{
"id": 2,
"name": "test-2",
"type": "thing",
"price": 100.0,
"meta": {
"name": "data"
}
},
{
"id": 3,
"name": "test-3",
"type": "something else"
}
]
}Usage
Returns
<strong>result:</strong>
<ul>
<li>Key: id, Value: 1</li>
<li>Key: name, Value: test-1</li>
<li>Key: type, Value: thing</li>
<li>Key: moreData, Value: more</li>
<li>Key: meta, Value: System.Dynamic.System.Collections.Generic.Dictionary`2[System.String,System.Object]</li>
<li>Key: id, Value: 2</li>
<li>Key: name, Value: test-2</li>
<li>Key: type, Value: thing</li>
<li>Key: price, Value: 100</li>
<li>Key: meta, Value: System.Dynamic.System.Collections.Generic.Dictionary`2[System.String,System.Object]</li>
</ul>
<ul>
<li>Key: id, Value: 1</li>
<li>Key: name, Value: test-1</li>
<li>Key: type, Value: thing</li>
<li>Key: moreData, Value: more</li>
<li>Key: meta, Value: System.Dynamic.System.Collections.Generic.Dictionary`2[System.String,System.Object]</li>
<li>Key: id, Value: 2</li>
<li>Key: name, Value: test-2</li>
<li>Key: type, Value: thing</li>
<li>Key: price, Value: 100</li>
<li>Key: meta, Value: System.Dynamic.System.Collections.Generic.Dictionary`2[System.String,System.Object]</li>
</ul>
<ul>
<li>Failed to find match</li>
</ul>
<ul>
<li>Key: id, Value: 2</li>
<li>Key: name, Value: test-2</li>
<li>Key: type, Value: thing</li>
<li>Key: price, Value: 100</li>
<li>Key: meta, Value: System.Dynamic.System.Collections.Generic.Dictionary`2[System.String,System.Object]</li>
</ul>
<ul>
<li>Key: id, Value: 2</li>
<li>Key: name, Value: test-2</li>
<li>Key: type, Value: thing</li>
<li>Key: price, Value: 100</li>
<li>Key: meta, Value: System.Dynamic.System.Collections.Generic.Dictionary`2[System.String,System.Object]</li>
<li>Key: id, Value: 3</li>
<li>Key: name, Value: test-3</li>
<li>Key: type, Value: something else</li>
</ul>| Summary | Determine whether or not the object passed in is the first element in the passed in array |
| Returns | Whether or not the object is the first element in the array |
| Remarks | |
| Parameters | |
| array | Array of objects to inspect |
| object | Object to match on |
Context
{
"array": [
"one",
"two",
"three"
]
}Usage
Returns
<strong>result:</strong>
<strong>True</strong>
<strong>False</strong>| Summary | Determine whether or not the object passed in is the last element in the passed in array |
| Returns | Whether or not the object is the last element in the array |
| Remarks | |
| Parameters | |
| array | Array of objects to inspect |
| object | Object to match on |
Context
{
"array": [
"one",
"two",
"three"
]
}Usage
Returns
<strong>result:</strong>
<strong>False</strong>
<strong>True</strong>| Summary | Pull object by key or index from a dynamic object or array |
| Returns | Object that is found |
| Remarks | |
| Parameters | |
| input | Object/array to pull from |
| lookup | Key/index to look for |
Context
{
"objects": {
"thing1": {
"id": 1,
"name": "test-1"
},
"thing2": {
"id": 2,
"name": "test-2"
},
"thing3": {
"id": 3,
"name": "test-3"
}
}
}Usage
Returns
<strong>result:</strong>
<ul>
<li>Key: id, Value: 1</li>
<li>Key: name, Value: test-1</li>
</ul>
<ul>
<li>Key: id, Value: 2</li>
<li>Key: name, Value: test-2</li>
</ul>
<ul>
<li>Failed to find match</li>
</ul>| Summary | Return a collection of elements ordered sequentially by the matching property value |
| Returns | A sequenced collection of elements |
| Remarks | If object is not an array, this will drop into the else block. Note: this can be used with an array of maps/objects, it does not need to be an array of simple types(string, numeric, bool, etc..) |
| If property is not found, this will return the original collection | |
| Parameters | |
| input | Array of elements to sequence |
| property | Property to match on |
Context
{
"array": [
{
"id": 3,
"name": "test3",
"price": 10.50,
"type": {
"id": 5,
"name": "type1"
}
},
{
"id": 1,
"name": "test1",
"price": 60.90,
"type": {
"id": 6,
"name": "type2"
}
},
{
"id": 2,
"name": "test2",
"price": 30.00,
"type": {
"id": 7,
"name": "type1"
}
},
{
"id": 4,
"name": "test4",
"price": 110.00,
"type": {
"id": 5,
"name": "type3"
}
}
],
"notArray": {
"id": 1
}
}Usage
Returns
<strong>Direct String Property:</strong>
<strong>True</strong>
<ul>
<li>Value: test1</li>
<li>Value: test2</li>
<li>Value: test3</li>
<li>Value: test4</li>
</ul>
<strong>Direct Decimal Property:</strong>
<strong>True</strong>
<ul>
<li>Value: test3</li>
<li>Value: test2</li>
<li>Value: test1</li>
<li>Value: test4</li>
</ul>
<strong>Nested Property Result:</strong>
<strong>True</strong>
<ul>
<li>Value: test3</li>
<li>Value: test4</li>
<li>Value: test1</li>
<li>Value: test2</li>
</ul>
<strong>Property Doesen't Exist Result:</strong>
<strong>True</strong>
<ul>
<li>Value: test3</li>
<li>Value: test1</li>
<li>Value: test2</li>
<li>Value: test4</li>
</ul>
<strong>Input Not an Array Result:</strong>
<strong>False</strong>| Summary | Return a collection of elements in descending order by the matching property value |
| Returns | A sequenced collection of elements |
| Remarks | If object is not an array, this will drop into the else block. Note: this can be used with an array of maps/objects, it does not need to be an array of simple types(string, numeric, bool, etc..) |
| If property is not found, this will return the original collection | |
| Parameters | |
| input | Array of elements to sequence |
| property | Property to match on |
Context
{
"array": [
{
"id": 3,
"name": "test3",
"price": 10.50,
"type": {
"id": 5,
"name": "type1"
}
},
{
"id": 1,
"name": "test1",
"price": 60.90,
"type": {
"id": 6,
"name": "type2"
}
},
{
"id": 2,
"name": "test2",
"price": 30.00,
"type": {
"id": 7,
"name": "type1"
}
},
{
"id": 4,
"name": "test4",
"price": 110.00,
"type": {
"id": 5,
"name": "type3"
}
}
],
"notArray": {
"id": 1
}
}Usage
Returns
<strong>Direct String Property:</strong>
<strong>True</strong>
<ul>
<li>Value: test4</li>
<li>Value: test3</li>
<li>Value: test2</li>
<li>Value: test1</li>
</ul>
<strong>Direct Decimal Property:</strong>
<strong>True</strong>
<ul>
<li>Value: test4</li>
<li>Value: test1</li>
<li>Value: test2</li>
<li>Value: test3</li>
</ul>
<strong>Nested Property Result:</strong>
<strong>True</strong>
<ul>
<li>Value: test2</li>
<li>Value: test1</li>
<li>Value: test3</li>
<li>Value: test4</li>
</ul>
<strong>Property Doesen't Exist Result:</strong>
<strong>True</strong>
<ul>
<li>Value: test3</li>
<li>Value: test1</li>
<li>Value: test2</li>
<li>Value: test4</li>
</ul>
<strong>Input Not an Array Result:</strong>
<strong>False</strong>| Summary | Return a collection of elements from an array, skipping N elements |
| Returns | A single page worth of elements |
| Remarks | If object is not an array, if page number is not passed in, or if page number or countPerPage are <= 0, this will drop into the else block. Note: this can be used with an array of maps/objects, it does not need to be an array of simple types(string, numeric, bool, etc..) |
| Parameters | |
| array | Array of objects to evaluate |
| pageNumber | Page number |
| countPerPage | Number of elements per page, default 0 |
Context
{
"array": [
"one",
"two",
"three",
"four",
"five"
],
"badInput": {
"something": true
}
}Usage
Returns
<strong>result:</strong>
<strong>True</strong>
<ul>
<li>Value: three</li>
<li>Value: four</li>
</ul>
<strong>False</strong>
<strong>False</strong>
<strong>False</strong>| Summary | Reverses the order of an array |
| Returns | An array with the element order reversed |
| Remarks | If object is not an array, if page number is not passed in, or if page number or countPerPage are <= 0, this will drop into the else block. Note: this can be used with an array of maps/objects, it does not need to be an array of simple types(string, numeric, bool, etc..) |
| Parameters | |
| input | Array of elements to reverse |
Context
{
"array": [
"one",
"two",
"three",
"four",
"five"
],
"badInput": {
"something": true
}
}Usage
Returns
<strong>Result:</strong>
<strong>True</strong>
<ul>
<li>Value: five</li>
<li>Value: four</li>
<li>Value: three</li>
<li>Value: two</li>
<li>Value: one</li>
</ul>
<strong>Input Not an Array Result:</strong>
<strong>False</strong>| Summary | Return a collection of properties from an array |
| Returns | Updated collection of elements |
| Remarks | If input is not an array, this will drop into the else block. Note: this can be used with an array of maps/objects, it does not need to be an array of simple types(string, numeric, bool, etc..) |
| If property is not found, this will return an empty array | |
| Parameters | |
| input | Array of objects to search |
| property | Property to match on |
Context
{
"array": [
{
"id": 1,
"name": "test1",
"type": {
"id": 5,
"name": "type1"
}
},
{
"id": 2,
"name": "test2",
"type": {
"id": 5,
"name": "type1",
"color": "blue"
}
},
{
"id": 3,
"name": "test2",
"type": {
"id": 6,
"name": "type2",
"color": "red"
}
},
{
"id": 4,
"name": "test3",
"type": {
"id": 7,
"name": "type3",
"color": "red"
}
}
],
"notArray": {
"id": 1
}
}Usage
Returns
<strong>Direct Property:</strong>
<strong>True</strong>
<ul>
<li>Value: test1</li>
<li>Value: test2</li>
<li>Value: test2</li>
<li>Value: test3</li>
</ul>
<strong>Object Property:</strong>
<strong>True</strong>
<ul>
<li>Value: 5</li>
<li>Value: 5</li>
<li>Value: 6</li>
<li>Value: 7</li>
</ul>
<strong>Nested Property:</strong>
<strong>True</strong>
<ul>
<li>Value: type1</li>
<li>Value: type1</li>
<li>Value: type2</li>
<li>Value: type3</li>
</ul>
<strong>Property Exists in Some Elements:</strong>
<strong>True</strong>
<ul>
<li>Value: blue</li>
<li>Value: red</li>
<li>Value: red</li>
</ul>
<strong>Property Doesen't Exist:</strong>
<strong>True</strong>
<ul>
</ul>
<strong>Input Not an Array:</strong>
<strong>False</strong>| Summary | Return a collection of elements from an array, skipping N elements |
| Returns | Collection of elements, minus the ones that were skipped |
| Remarks | If object is not an array, this will drop into the else block. Note: this can be used with an array of maps/objects, it does not need to be an array of simple types(string, numeric, bool, etc..) |
| Parameters | |
| array | Array of objects to evaluate |
| skipN | Number of elements to skip |
Context
{
"array": [
"one",
"two",
"three"
],
"badInput": {
"something": true
}
}Usage
Returns
<strong>result:</strong>
<strong>True</strong>
<ul>
<li>Value: three</li>
</ul>
<strong>False</strong>| Summary | Sort an array of elements |
| Returns | A sorted array |
| Remarks | If object is not an array, if page number is not passed in, or if page number or countPerPage are <= 0, this will drop into the else block. |
| This only works with arrays of simple types(string, numeric, bool, etc..). Sorting non-simple types will return an empty array. | |
| Parameters | |
| input | Array of elements to sort |
Context
{
"stringArray": [
"one",
"two",
"three",
"four",
"five"
],
"numericArray": [
5,
3,
4,
1,
2
],
"objectArray": [
{
"id": 2
},
{
"id": 1
}
],
"badInput": {
"something": true
}
}Usage
Returns
<strong>String Array:</strong>
<strong>True</strong>
<ul>
<li>Value: five</li>
<li>Value: four</li>
<li>Value: one</li>
<li>Value: three</li>
<li>Value: two</li>
</ul>
<strong>Numeric Array:</strong>
<strong>True</strong>
<ul>
<li>Value: 1</li>
<li>Value: 2</li>
<li>Value: 3</li>
<li>Value: 4</li>
<li>Value: 5</li>
</ul>
<strong>Object Array:</strong>
<strong>True</strong>
<ul>
</ul>
<strong>Input Not an Array:</strong>
<strong>False</strong>| Summary | Return a collection of N elements from an array |
| Returns | Collection of N elements |
| Remarks | If object is not an array, this will drop into the else block. Note: this can be used with an array of maps/objects, it does not need to be an array of simple types(string, numeric, bool, etc..) |
| Parameters | |
| array | Array of objects to evaluate |
| takeN | Number of elements to return |
Context
{
"array": [
"one",
"two",
"three"
],
"badInput": {
"something": true
}
}Usage
Returns
<strong>result:</strong>
<strong>True</strong>
<ul>
<li>Value: one</li>
<li>Value: two</li>
</ul>
<strong>False</strong>