Subtract
How to use the Subtract operator
The Subtract
operator allows you to perform a subtraction on two number values, e.g. 6 - 4 = 2.
Allowed Children
Arithmetic nodes, Primitive and Reference nodes of Number type
Requirements
Must have 2 children
Return Type
Number
Example: Basic structure
{
"type": "Subtract",
"properties": {},
"children": [
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_justANumberAttribute"
}
},
{
"type": "Number",
"properties": {
"value": 3
}
}
]
}
Example: Simple Subtract query
Find items where the difference of two specified attribute values are equal to 5.
{
"type": "Query",
"properties": {
"dodiCode": "designs_exampleJobs",
"attributes": ["all"]
},
"children": [
{
"type": "Equals",
"children": [
{
"type": "Subtract",
"children": [
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_jobsConeCount"
}
},
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_jobsSafetyLightsCount"
}
}
]
},
{
"type": "Number",
"value": ["5"]
}
]
}
]
}