Select (TQL)
Select TQL queries allow users to obtain specific numerical, textual or polygonal information from the data in a session of a project. By adding various clauses to a selection statement, the query can be made more specific.
Composition of a Select Query
A Select TQL query always start using the SELECT statement for TQL provides a means of obtaining data of a session.
The 'Select' statement is consists of the SELECT word followed by a selection type and the word WHERE. Depending on the selection type one or more clauses can be added. Clauses are separated with the AND word. All of these parts are separated by an underscore _.
An example of a TQL select statement is: SELECT_LOTSIZE_WHERE_CATEGORY_IS_SOCIAL_AND_STAKEHOLDERTYPE_IS_MUNICIPALITY. In this example, SELECT_LOTSIZE_WHERE is the statement. CATEGORY_IS_SOCIAL is the first clause, and STAKEHOLDERTYPE_IS_MUNICIPALITY is the second clause. It would return all the land area taken up with social housing, which is also owned by a municipal stakeholder.
Executing a Select Query
TQL Queries can be executed using:
- Query Tool in the Tygron Platform; For creating and testing TQL queries.
- Globals; Executed every calculation.
- Names in Excels; Used for Indicator and Panels and supports more complex queries.
EditorBuildingEventType:QUERYusing the API
List of Select types
| Select | Unit | Description | Fixed clause amount | Polygon based |
|---|---|---|---|---|
| ACTIVE | boolean | Returns whether an Item is active in this session | 1 | false |
| ATTRIBUTE | decimal | Returns the attribute value of an Item | No | false |
| COLOR | HEX Color | Returns the value of the Color of an Item in HEX format | 1 | false |
| DISTANCE | decimal | Returns the distance between two items | 2 | false |
| EXPENSES | valuta | Returns the sum of cost book values of a Stakeholder | 1 | false |
| FLOORSIZE | m² | Returns the total floorspace of buildings (lot size x floors) | No | true |
| GLOBAL | decimal | Returns a value of a Global | No | false |
| HEIGHT |
m + datum m |
Returns the average datum height of a polygon. Or the height of a specific Building |
No | true |
| ID | Item ID | Returns the unique ID of an Item as an Integer | No | false |
| GRIDAVG | decimal | Returns the average grid value for the query polygons an a specified Grid | No | true |
| GRIDMIN | decimal | Returns the minimum grid value for the query polygons an a specified Grid | No | true |
| GRIDMAX | decimal | Returns the maximum grid value for the query polygons an a specified Grid | No | true |
| GRIDVOLUME | decimal | Returns the sum of grid values, multiplied with the grid cell's area size, for the query polygons and a specified Grid | No | true |
| GRIDSTDEV | decimal | Returns the standard deviation of grid values for the query polygons an a specified Grid | No | true |
| LANDPOLYGONS | polygons | Returns the query polygons | No | true |
| LANDSIZE | decimal | Returns the surface size of the query polygons | No | true |
| LENGTH | m | Returns the length of Net Lines | No | false |
| LEVEES | m² | Returns the total Levee surface size. | No | true |
| LOTPOLYGONS | polygons | Returns the intersection polygons between Buildings and the query polygons | No | true |
| LOTSIZE | decimal | Returns the total surface size of the intersection between Buildings and the query polygons | No | true |
| NAME | text | Returns the name of an Item | No | false |
| NET_STATE | Net state | Returns the net state of an item. | 1 | false |
| REVENUE | valuta | Returns the sum of income book values of a Stakeholder | 1 | false |
| SESSIONSTATE | Session state | Returns the current State of Session | 0 | false |
| STATE | Timestate | Returns the timestate of an item. | 1 | false |
| TARGET | decimal | Returns the (category) target of an indicator. | No | false |
| TOKEN | String | Returns the Session's API token | 0 | false |
| TOPFLOOR | Integer | Returns the amount of floors of the Building's section with the most amount of floors | No | false |
| UNITS | decimal | Returns the number of residential units, based on the buildings size per unit | No | true |