ID (TQL): Difference between revisions

From Tygron Support wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
Instead of specifying the value of a clause parameter with a particular [[Item ID]], it is possible to use the 'ID' characters for its value. The result of using 'ID' for the clause value, is that is automatically filled in using the Item that contains the TQL statement.
Instead of a specific [[Item ID]], you can use 'ID' as a clause parameter value. This is automatically replaced by the ID of the Item containing the TQL statement.


ID clause values are often used in combination with [[Template Panel]]s; For example: Consider A Template Text Panel applied on Neighborhoods  
ID clause values are often used in combination with [[Template Panel]]s; For example: Consider A Template Text Panel applied on Neighborhoods  
Line 7: Line 7:
<pre>
<pre>
[  
[  
  { "id" : 0, "name" : "East Side", "attributes": { "INHABITANTS": 600.0 } },
  { "id" : 0, "name" : "East Side", "attributes": { "INHABITANTS": [ 600.0 ] } },
  { "id" : 1, "name" : "West Side", "attributes": { "INHABITANTS": 200.0 } }
  { "id" : 1, "name" : "West Side", "attributes": { "INHABITANTS": [ 200.0 ] } }
]
]
</pre>
</pre>


And a Template Text Panel applied on Neighborhoods:
And a Template Text Panel applied on Neighborhoods, resulting in two Text Panel instances:
<pre>
<pre>
[ {  
[  
{  
   "id" : 2, "mapLink" : "NEIGHBORHOODS", "name" : "Template Text Panel",  "type" : "TEMPLATE_TEXT_PANEL",
   "id" : 2, "mapLink" : "NEIGHBORHOODS", "name" : "Template Text Panel",  "type" : "TEMPLATE_TEXT_PANEL",
   "text" : "Name: $SELECT_NAME_WHERE_NEIGHBORHOOD_IS_ID<br>Inhabitants: $SELECT_ATTRIBUTE_WHERE_NEIGHBORHOOD_IS_ID_AND_NAME_IS_INHABITANTS"   
   "text" : "Name: $SELECT_NAME_WHERE_NEIGHBORHOOD_IS_ID<br>Inhabitants: $SELECT_ATTRIBUTE_WHERE_NEIGHBORHOOD_IS_ID_AND_NAME_IS_INHABITANTS"   
},{  
} , {  
   "contentID" : 0, "contentMapLink" : "NEIGHBORHOODS",  "id" : 3,  "name" : "Template Text Panel: East Side",  "parentID" : 2,  "type" : "TEXT_PANEL"  
   "contentID" : 0, "contentMapLink" : "NEIGHBORHOODS",  "id" : 3,  "name" : "Template Text Panel: East Side",  "parentID" : 2,  "type" : "TEXT_PANEL"  
},{  
} , {  
   "contentID" : 1, "contentMapLink" : "NEIGHBORHOODS", "id" : 4, "name" : "Template Text Panel: West Side", "parentID" : 2, "type" : "TEXT_PANEL"  
   "contentID" : 1, "contentMapLink" : "NEIGHBORHOODS", "id" : 4, "name" : "Template Text Panel: West Side", "parentID" : 2, "type" : "TEXT_PANEL"  
} ]
}  
]
</pre>
</pre>


The TQL statement  
Since each panel is linked to a particular Neighborhood, through the ''contentID'' and ''contentMaplink'' parameters, the TQL statement <code>SELECT_NAME_WHERE_NEIGHBORHOOD_IS_ID</code> is internally replaced with:
<pre>SELECT_NAME_WHERE_NEIGHBORHOOD_IS_ID</pre> is internally replaced with
:<code>SELECT_NAME_WHERE_NEIGHBORHOOD_IS_0</code> for the first Text Panel
<pre>SELECT_NAME_WHERE_NEIGHBORHOOD_IS_0/pre> for the first Text Panel and <pre>SELECT_NAME_WHERE_NEIGHBORHOOD_IS_1/pre> for the second Text Panel, as these are the Neighborhoods each panel is linked to (using the ''contentID'' and ''contentMaplink'' parameters).
:<code>SELECT_NAME_WHERE_NEIGHBORHOOD_IS_1</code> for the second Text Panel
 
The result of each query will be:
The result of each query will be:
<pre>"East Side"</pre> and <pre>"West Side"</pre>
<code>"East Side"</code> and <code>"West Side"</code>
 
Similarly, the value of the attribute INHABITANTS of the linked Neighborhood can be obtained using  
Similarly, the value of the attribute INHABITANTS of the linked Neighborhood can be obtained using  
<pre>SELECT_ATTRIBUTE_WHERE_NEIGHBORHOOD_IS_ID_AND_NAME_IS_INHABITANTS</pre>.
<code>SELECT_ATTRIBUTE_WHERE_NEIGHBORHOOD_IS_ID_AND_NAME_IS_INHABITANTS</code>.


==Clause Parameters==
==Clause Parameters==
Line 39: Line 43:
|seealso=
|seealso=
*[[Y (TQL)]]
*[[Y (TQL)]]
*[[XA (TQL)]]
*[[X (TQL)]]
*[[XC (TQL)]]
*[[Item ID]]
*[[XK (TQL)]]
|api=*[[Api session event editor building query]]
 
}}
}}


{{TQL param nav}}
{{TQL param nav}}

Latest revision as of 08:41, 8 July 2026

Instead of a specific Item ID, you can use 'ID' as a clause parameter value. This is automatically replaced by the ID of the Item containing the TQL statement.

ID clause values are often used in combination with Template Panels; For example: Consider A Template Text Panel applied on Neighborhoods

Example

Consider the following (simplified) Neighborhood data of a project:

[ 
 { "id" : 0, "name" : "East Side", "attributes": { "INHABITANTS": [ 600.0 ] } },
 { "id" : 1, "name" : "West Side", "attributes": { "INHABITANTS": [ 200.0 ] } }
]

And a Template Text Panel applied on Neighborhoods, resulting in two Text Panel instances:

[ 
 { 
  "id" : 2, "mapLink" : "NEIGHBORHOODS", "name" : "Template Text Panel",  "type" : "TEMPLATE_TEXT_PANEL",
  "text" : "Name: $SELECT_NAME_WHERE_NEIGHBORHOOD_IS_ID<br>Inhabitants: $SELECT_ATTRIBUTE_WHERE_NEIGHBORHOOD_IS_ID_AND_NAME_IS_INHABITANTS"  
 } , { 
  "contentID" : 0, "contentMapLink" : "NEIGHBORHOODS",  "id" : 3,  "name" : "Template Text Panel: East Side",   "parentID" : 2,  "type" : "TEXT_PANEL" 
 } , { 
  "contentID" : 1, "contentMapLink" : "NEIGHBORHOODS", "id" : 4, "name" : "Template Text Panel: West Side", "parentID" : 2, "type" : "TEXT_PANEL" 
 } 
]

Since each panel is linked to a particular Neighborhood, through the contentID and contentMaplink parameters, the TQL statement SELECT_NAME_WHERE_NEIGHBORHOOD_IS_ID is internally replaced with:

SELECT_NAME_WHERE_NEIGHBORHOOD_IS_0 for the first Text Panel
SELECT_NAME_WHERE_NEIGHBORHOOD_IS_1 for the second Text Panel

The result of each query will be: "East Side" and "West Side"

Similarly, the value of the attribute INHABITANTS of the linked Neighborhood can be obtained using SELECT_ATTRIBUTE_WHERE_NEIGHBORHOOD_IS_ID_AND_NAME_IS_INHABITANTS.

Clause Parameters

The X value can be used in the following TQL Clause parameters: