* '''emptyItemAtStart''': Existence of this item inserts an empty entry at the beginning of the selectlist.
* '''emptyItemAtEnd''': Existence of this item inserts an empty entry at the end of the selectlist.
* '''emptyHide''': Existence of this item hides the empty entry. This is usefull for e.g. Enums, which have a en empty
entry and the empty value should not be an option to be selected.
Type: select
^^^^^^^^^^^^^^^^^^^^
...
...
@@ -727,6 +731,8 @@ Type: select
* '''emptyItemAtStart''': Existence of this item inserts an empty entry at the beginning of the selectlist.
* '''emptyItemAtEnd''': Existence of this item inserts an empty entry at the end of the selectlist.
* '''emptyHide''': Existence of this item hides the empty entry. This is usefull for e.g. Enums, which have a en empty
entry and the empty value should not be an option to be selected.
Type: subrecord
^^^^^^^^^^^^^^^
...
...
@@ -855,15 +861,16 @@ A simple example
^^^^^^^^^^^^^^^^
Assume that the database has a table person with columns first_name and last_name. To create a simple list of all persons, we can do the following:
::
10.sql = SELECT id AS person_id, CONCAT(first_name, " ", last_name, " ") AS name FROM person
10 Stands for a *root level* of the report (see section ?structure). 10.sql defines a SQL query for this specific level. When the query is executed it will return a result having one single column name containing first- and last name
separated by a space character.
The HTML output displayed on the page resulting from only this definition could look as follows:
::
Marc MusterElton JohnSpeedy Gonzales
..
...
...
@@ -876,26 +883,17 @@ However, we can modify (wrap) the output by setting the values of various ?keys
::
10.sql = SELECT id AS person_id, CONCAT(first_name, " ", last_name, " ") AS name FROM person
10.sep = <br />
Marc Muster<br />Elton John<br />Speedy Conzales<br />
..
which gives us the desired simple list (we use linebreaks for simplicity here) when displayed by a browser:
HTML output:
::
Marc Muster
Elton John
Speedy Conzales
Marc Muster<br />Elton John<br />Speedy Conzales<br />
..
Syntax
------
...
...
@@ -955,8 +953,6 @@ See the example below:
..
This would result in
::
...
...
@@ -968,26 +964,76 @@ This would result in
..
Across several lines
^^^^^^^^^^^^^^^^^^^^
To make SQL quieres more readable, it's possible to split a line across several lines. Lines with keywords are on their
own - if there are non 'keyword' lines, they will be appended at the last keyword line. 'Keyword' lines:
* <level>.<keyword> =
* {
* <level> {
Example::
10.sql = SELECT 'hello world'
FROM mastertable
10.tail = End
20.sql = SELECT 'a warm welcome'
'some additional', 'columns'
FROM smartTable
WHERE id>100
20.head = <h3>
20.tail = </h3>
Nesting of levels
^^^^^^^^^^^^^^^^^
Levels can be nested by using curly brackets::
10.sql = SELECT 'hello world'
20 {
sql = SELECT 'a new query'
head = <h1>
tail = </h1>
}
30 {
sql = SELECT 'a third query'
head = <h1>
tail = </h1>
40 {
sql = SELECT 'a nested nested query'
}
}
30.40.tail = End
50
{
sql = SELECT 'A query with braces on their own'
}
Columns of the upper level result can be accessed via variables, eg. {{10.person_id}} will be replaced by the value in the person_id column.
|**Example |**10** and **20** is a root level and will be executed independently. **10** don't have a sub level. **20.20** will be executed as many times as **20** has row numbers. **20.30.10** won't be executed because there isn't |
|**Example |**10** and **20** are root level and will be executed independently. **10** don't have a sub level. **20.25** will be executed as many times as **20** has row numbers. **20.30.10** won't be executed because there isn't |