Skip to main content

Value From Item Attribute

How to use the ValueFromItemAttribute node

The ValueFromItemAttribute node allows you to use attribute values from specific items in an AQS query. This node resolves to a value primitive whose type will depend on the selected attribute on the target item.

For example, if the item is of the Location of Interest design and the attribute is Geometry, the value type will be of type geometry.

Properties

Property NameTypeRequiredDescription
dodiCodeGuctrueThe source item DoDI code
attributeCodeGuctrueThe source item target attribute

Allowed Children

None

Requirements

N/A

Return Type

number, string, boolean, date, geometry

Example use case

As an example, we can consider a query that wants to fetch all the assets within the geometry attribute of the item with id 60c32c0f22c6f0022688e08a. This is, in our example, the item whose geometry is representing the boundary of an area of interest such as a state held in the design design_states. This query will be no different than specifying the geometry representing the boundary directly within the query using a Geometry node.

However, by using ValueFromItemAttribute instead of Geometry, we can use the same query across different layers, workflows, reports, etc. and if the boundary definition is changed, all queries that depend on this boundary would not require updating as the geometry would be determined at query execution time rather than at the time of query definition.

{
"type": "Query",
"properties": {
"dodiCode": "designInterfaces_assets",
"attributes": ["attributes_itemsTitle", "attributes_itemsSubtitle"]
},
"children": [
{
"type": "GeomIntersects",
"children": [
{
"type": "Attribute",
"properties": { "attributeCode": "attributes_itemsGeometry" }
},
{
"type": "ValueFromItemAttribute",
"properties": {
"dodiCode": "designs_states",
"attributeCode": "attributes_itemsGeometry",
"value": ["60c32c0f22c6f0022688e08a"]
}
}
]
}
]
}

This flexible capability may be extended further through the use of AQS parameters where the item Id (whose attribute value we wish to use) is passed as a parameter to the query. We can therefore create an AQS query where the item to get the geometry from is also specified only when running the query allowing you to query assets in different states all using the same query for example:

{
"type": "Query",
"properties": {
"dodiCode": "designInterfaces_assets",
"attributes": ["attributes_itemsTitle", "attributes_itemsSubtitle"],
"parameters": [
{
"name": "StateItemIdParameter",
"title": "State Item Id",
"type": "AlloyId"
}
]
},
"children": [
{
"type": "GeomIntersects",
"children": [
{
"type": "Attribute",
"properties": { "attributeCode": "attributes_itemsGeometry" }
},
{
"type": "ValueFromItemAttribute",
"properties": {
"dodiCode": "designs_states",
"attributeCode": "attributes_itemsGeometry",
"parameterName": "StateItemIdParameter"
}
}
]
}
]
}