Skip to main content

Subtract node

Description

The Subtract node takes two numbers as input and subtracts the first from the second, e.g. 8 - 6 = 2

Usage

This node is a function. It can be added to the segments of comparison nodes and other functions.

alt text

It can be:

Options

Select the node to access its options:

  • Swap - use a different function node. Any populated segments are kept, which limits the options.

  • Delete - remove the node from the segment.

Example

Fetch all street lights with a column 2 metres shorter than this particular one

In full detail:

Fetch items of the Street Lights design where their Column Height attribute is less than the Column Height attribute of a particular Street Light item minus 2

alt text
See JSON code

This code may reference designs, interfaces, attributes or items that don't exist in your company project.

{
"type": "Query",
"properties": {
"collectionCode": "Live",
"dodiCode": "designs_streetLights"
},
"children": [
{
"type": "LessThan",
"children": [
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_streetLightsColumnHeight_5e1db714ca31500ad87c5d18"
}
},
{
"type": "Subtract",
"children": [
{
"type": "ValueFromItemAttribute",
"properties": {
"attributeCode": "attributes_streetLightsColumnHeight_5e1db714ca31500ad87c5d18",
"dodiCode": "designs_streetLights",
"value": ["5d95cc05ca314f0a302da717"]
}
},
{
"type": "Number",
"properties": {
"value": [2]
}
}
]
}
]
}
]
}