col.xyz.query
Specify a source to initialize a list
Class | Column |
---|---|
Property | col.xyz.query |
Formal specification | col.xyz.query = <datasource specific query> |
Required | no |
Default | |
Version | 1.0 |
Comment | Be very carefull with the queries. The risk exists that a query brings down the database instance, or even wipe all the data in the db. To mitigate this risk ensure that the user has only read and create table authorizations. There are 2 sources to populate a list:Â |
Example | col.city=CitiesÂ
col.city.type = listÂ
col.city.query=select cityName, id from cities order by cityNameÂ
col.city.query.ds = touristInfo
|
Reference | col.xyz.type = list |
Using dynamic queries
When you create a list query, the add-on will take the first as the name and the second value as the value (which should be unique, for the purpose of being used as id, otherwise the grid will cut off all other options as duplicates).
So for instance if you have
...
col.city = City
col.city.type = list
col.city.query = select cityname, zipcode from cities
...
Â
it will store 'cityname' in the table attribute city_name and 'zipcode' in the table attribute city
(zipcode is considered as the value). If you select just one field like in
col.city.query = select cityname from cities
Â
Both attributes ('city' and 'city_name') will get the selected cityname
In the case when you select more than 2 attributes, to cover Using list values in formulas  you need to make sure that
the second attribute in the select list is the value you want to store in the value column of the list.
Â