Skip to main content

Divide

How to use the Divide operator

The Divide operator allows you to divide 2 values, e.g. 10 / 2.

Allowed Children

Arithmetic nodes, Primitive and Reference nodes of Number type

Requirements

Must have 2 children

Return Type

Number

Example: Basic structure
{
"type": "Divide",
"properties": {},
"children": [
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_justANumberAttribute"
}
},
{
"type": "Number",
"properties": {
"value": 2
}
}
]
}
Example: Simple Divide query

Find items where the result of the division of two specified attribute values is equal to 2.

{
"type": "Query",
"properties": {
"dodiCode": "designs_exampleJobs",
"attributes": ["all"]
},
"children": [
{
"type": "Equals",
"children": [
{
"type": "Divide",
"children": [
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_jobsConeCount"
}
},
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_jobsSafetyLightsCount"
}
}
]
},
{
"type": "Number",
"value": ["2"]
}
]
}
]
}