Example 3 - Logical branches
This example demonstrates how to build the following query in the AQS Builder:
Fetch all jobs created between 15 March 2021 and 30 April 2021, sorted by priority
In full detail:
Fetch items of the Jobs interface where their Raised Time attribute is greater than 15 March 2021 AND less than 30 April 2021, sorted by their Priority attribute in Descending order
Configure the root node
-
Select the root node and set the following properties:
- AQS Type - AQS Query
- Design or interface - Jobs
- Collection - Live
- Sorting - Descending
- Sort attribute - Priority
- Attributes - Title, Subtitle, Raised Time, Priority
Add a logical node
- Select and choose the All node type from the list. This means that, for items to be included in the query results, they must fulfil all the comparison nodes you add after this one.
Add the first comparison node
- Select and choose the Greater than node type from the list. The query will split into two branches.
Fill the left segment
- Select on the left and choose the Attribute node type from the list. The node will default to the first relevant attribute in the design/interface being queried.
- To change the selected attribute, select to open the Pathfinder. Select the Raised Time attribute.
Fill the right segment
- Select on the right and choose the Date Time node type. It will default to today's date.
- Select today's date to open the calendar picker. Use it to add the desired date and time.
Add the second comparison node
- Perform similar steps to add a second comparison node.
Note
You can add any number of comparison nodes to a logic node, enabling you to build highly precise queries.
Finish
- Select Done (bottom-left) to finish.
See JSON code
{
"type": "Query",
"properties": {
"attributes": ["attributes_itemsTitle", "attributes_itemsSubtitle", "attributes_tasksRaisedTime", "attributes_tasksPriority"],
"collectionCode": "Live",
"dodiCode": "designInterfaces_jobs",
"sortInfo": {
"attributeCode": "attributes_tasksPriority",
"sortOrder": "Descending"
}
},
"children": [
{
"type": "And",
"children": [
{
"type": "GreaterThan",
"children": [
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_tasksRaisedTime"
}
},
{
"type": "DateTime",
"properties": {
"value": ["2021-03-15T00:00:00.000Z"]
}
}
]
},
{
"type": "LessThan",
"children": [
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_tasksRaisedTime"
}
},
{
"type": "DateTime",
"properties": {
"value": ["2021-04-29T23:00:00.000Z"]
}
}
]
}
]
}
]
}