Skip to main content

Starts With node

Description

The Starts with node takes two inputs. It filters the items in your query by checking if the specified attribute begins with the inputted text string, e.g. hello

Usage

The Starts with node is a condition, so it can be added to the query branch directly after the root node or a logical node.

alt text
alt text

It can be populated with these nodes:

Configuration

alt text
  • Swap - change the comparison node. If any segments hold values, they'll remain but the node types offered will be limited.

  • Delete - remove the node from the query.

  • Link negated - enable this to invert the condition imposed by the node. Items must now fail the condition to be included in the query results.

Example

Fetch all street lights with a unit number starting with SL/002

In full detail:

Fetch items of the Street Lights design where their Unit Number attribute starts with SL/002

alt text
See JSON code

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

{
"type": "Query",
"properties": {
"collectionCode": "Live",
"dodiCode": "designs_streetLights"
},
"children": [
{
"type": "StartsWith",
"children": [
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_streetLightingUnitsUnitNumber"
}
},
{
"type": "String",
"properties": {
"value": ["SL/002"]
}
}
]
}
]
}