Skip to main content

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

  1. 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
alt text

Add a logical node

  1. 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.
alt text
alt text

Add the first comparison node

  1. Select and choose the Greater than node type from the list. The query will split into two branches.
alt text
alt text

Fill the left segment

  1. 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.
alt text
  1. To change the selected attribute, select to open the Pathfinder. Select the Raised Time attribute.
alt text
alt text

Fill the right segment

  1. Select on the right and choose the Date Time node type. It will default to today's date.
alt text
alt text
  1. Select today's date to open the calendar picker. Use it to add the desired date and time.
alt text
alt text

Add the second comparison node

  1. Perform similar steps to add a second comparison node.
alt text
Note

You can add any number of comparison nodes to a logic node, enabling you to build highly precise queries.

Finish

  1. 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"]
}
}
]
}
]
}
]
}