XK (TQL): Difference between revisions
No edit summary |
|||
| (12 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
The XK clause value is a variation on the [[XA (TQL)|XA]] clause value. The characters 'XK' should be followed by an underscore and the name of a [[Key]]; for example '''XK_CULVERT_DIAMETER'''. Also see the [[#Example|example ]]below. | The 'XK' clause value is a variation on the [[XA (TQL)|'XA']] clause value. The characters 'XK' should be followed by an underscore and the name of a [[Key]]; for example '''XK_CULVERT_DIAMETER'''. Also see the [[#Example|example ]]below. | ||
This Key is used to obtain the name of an Attribute, given a Grid Overlay. This Grid Overlay is obtained from the same TQL statement, which should contain one of the following clause parameters: | This Key is used to obtain the name of an Attribute, given a Grid Overlay. This Grid Overlay is obtained from the same TQL statement, which should contain one of the following clause parameters: | ||
| Line 6: | Line 6: | ||
* [[Gridtype (TQL Param)]] | * [[Gridtype (TQL Param)]] | ||
The result of using 'XK' for the clause value, is the automatic creation of multiple TQL statements, one with each Item ID for that Clause Parameter that can be found in the project data. Items are only taken into account of they | The result of using 'XK' for the clause value, is the automatic creation of multiple TQL statements, one with each Item ID for that Clause Parameter that can be found in the project data. Items are only taken into account of they have a non zero value for the attribute specified by the Grid Overlay [[Key]]. | ||
Internally, the resulting TQL statements are placed in a single array; Similarly the result will be an array of TQL results. | Internally, the resulting TQL statements are placed in a single array; Similarly the result will be an array of TQL results. | ||
==Example== | ==Example== | ||
| Line 21: | Line 19: | ||
{ "id" : 3, "name" : "Duiker C", "attributes": { "CULVERT_DIAMETER" : [1.0] } }, | { "id" : 3, "name" : "Duiker C", "attributes": { "CULVERT_DIAMETER" : [1.0] } }, | ||
{ "id" : 4, "name" : "Duiker K", "attributes": { "CULVERT_DIAMETER" : [2.0], "MEASURED_DIAM" : [0.0] } } | { "id" : 4, "name" : "Duiker K", "attributes": { "CULVERT_DIAMETER" : [2.0], "MEASURED_DIAM" : [0.0] } } | ||
{ "id" : | { "id" : 5, "name" : "Duiker M", "attributes": { "CULVERT_DIAMETER" : [0.0], "MEASURED_DIAM" : [2.0] } }, | ||
] | ] | ||
</pre> | </pre> | ||
And the Grid Overlay in the same project: | And the Grid Overlay in the same project: | ||
<pre> | <pre>{ "id" : 6, "name" : "Water Overlay", "type" : "RAINFALL" , "keys": { "CULVERT_DIAMETER" : "MEASURED_DIAM" } }</pre> | ||
{ "id" : | |||
</pre> | |||
The TQL statement | The TQL statement to obtain the names of the Culverts used by the Water Overlay is: | ||
<pre> | <pre>SELECT_NAME_WHERE_BUILDING_IS_XK_CULVERT_DIAMETER_AND_GRID_IS_6</pre> | ||
<pre> | which internally is replaced with a list of TQL statements, separated by comma's, | ||
Its result will be a list of names, separated by comma's | <pre>SELECT_NAME_WHERE_BUILDING_IS_0_AND_GRID_IS_6, SELECT_NAME_WHERE_BUILDING_IS_2_AND_GRID_IS_6, SELECT_NAME_WHERE_BUILDING_IS_5_AND_GRID_IS_6</pre> | ||
<pre>" | Its result will be a list of names, separated by comma's: | ||
<pre>"Duiker A", "Duiker B", "Duiker M"</pre> | |||
Similarly, the TQL statement to obtain the culvert Diameters of the Culverts used by the water Overlay is: | |||
<pre>SELECT_ATTRIBUTE_WHERE_BUILDING_IS_XK_CULVERT_DIAMETER_AND_GRID_IS_6_AND_KEY_IS_CULVERT_DIAMETER</pre> | |||
Its result will be a list of values, separated by comma's: | |||
<pre>0.2, 1.0, 2.0</pre> | |||
==Clause Parameters== | ==Clause Parameters== | ||
The | The XK value can be used in the following TQL Clause parameters: | ||
{{article end | {{article end | ||
|notes=*In case no Grid is specified by any of the other clauses of the original TQL statement, the result will be 0 generated TQL statements; an empty array. | |notes=*In case no Grid is specified by any of the other clauses of the original TQL statement, the result will be 0 generated TQL statements; an empty array. | ||
|seealso= | |seealso= | ||
*[[ | *[[YK (TQL)]] | ||
*[[X (TQL)]] | |||
*[[XA (TQL)]] | *[[XA (TQL)]] | ||
*[[XC (TQL)]] | *[[XC (TQL)]] | ||
}} | }} | ||
Latest revision as of 14:36, 15 May 2026
The 'XK' clause value is a variation on the 'XA' clause value. The characters 'XK' should be followed by an underscore and the name of a Key; for example XK_CULVERT_DIAMETER. Also see the example below.
This Key is used to obtain the name of an Attribute, given a Grid Overlay. This Grid Overlay is obtained from the same TQL statement, which should contain one of the following clause parameters:
The result of using 'XK' for the clause value, is the automatic creation of multiple TQL statements, one with each Item ID for that Clause Parameter that can be found in the project data. Items are only taken into account of they have a non zero value for the attribute specified by the Grid Overlay Key.
Internally, the resulting TQL statements are placed in a single array; Similarly the result will be an array of TQL results.
Example
Consider the following (simplified) Building data of a project:
[
{ "id" : 0, "name" : "Duiker A", "attributes": { "CULVERT_DIAMETER" : [1.0], "MEASURED_DIAM" : [0.2] } },
{ "id" : 1, "name" : "Kerklaan", "attributes": { "MONUMENTAL_HOUSE" : [1.0] } },
{ "id" : 2, "name" : "Duiker B", "attributes": { "CULVERT_DIAMETER" : [0.5], "MEASURED_DIAM" : [1.0], } },
{ "id" : 3, "name" : "Duiker C", "attributes": { "CULVERT_DIAMETER" : [1.0] } },
{ "id" : 4, "name" : "Duiker K", "attributes": { "CULVERT_DIAMETER" : [2.0], "MEASURED_DIAM" : [0.0] } }
{ "id" : 5, "name" : "Duiker M", "attributes": { "CULVERT_DIAMETER" : [0.0], "MEASURED_DIAM" : [2.0] } },
]
And the Grid Overlay in the same project:
{ "id" : 6, "name" : "Water Overlay", "type" : "RAINFALL" , "keys": { "CULVERT_DIAMETER" : "MEASURED_DIAM" } }
The TQL statement to obtain the names of the Culverts used by the Water Overlay is:
SELECT_NAME_WHERE_BUILDING_IS_XK_CULVERT_DIAMETER_AND_GRID_IS_6
which internally is replaced with a list of TQL statements, separated by comma's,
SELECT_NAME_WHERE_BUILDING_IS_0_AND_GRID_IS_6, SELECT_NAME_WHERE_BUILDING_IS_2_AND_GRID_IS_6, SELECT_NAME_WHERE_BUILDING_IS_5_AND_GRID_IS_6
Its result will be a list of names, separated by comma's:
"Duiker A", "Duiker B", "Duiker M"
Similarly, the TQL statement to obtain the culvert Diameters of the Culverts used by the water Overlay is:
SELECT_ATTRIBUTE_WHERE_BUILDING_IS_XK_CULVERT_DIAMETER_AND_GRID_IS_6_AND_KEY_IS_CULVERT_DIAMETER
Its result will be a list of values, separated by comma's:
0.2, 1.0, 2.0
Clause Parameters
The XK value can be used in the following TQL Clause parameters:
Notes
- In case no Grid is specified by any of the other clauses of the original TQL statement, the result will be 0 generated TQL statements; an empty array.
See also