Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
ceb35066
Commit
ceb35066
authored
Mar 20, 2021
by
Carsten Rose
Browse files
Refs #11998 - Add explanation to qfq function example code.
parent
da4212db
Pipeline
#5052
passed with stages
in 3 minutes and 40 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Documentation/Report.rst
View file @
ceb35066
...
...
@@ -1948,14 +1948,15 @@ QFQ Function
QFQ SQL reports can be reused, similar to a function in a regular programming language, including call parameter and return
values.
* Per tt-content record the field 'subheader' (in Typo3 backend)
has to be used to
define the function name. The function
* Per tt-content record the field 'subheader' (in Typo3 backend) define
s
the function name. The function
can also referenced by using the tt-content number (`uid`) - but this is less readable.
* The calling report calls the function by defining ``
<level>
.function =
<function
name
>
(var1, var2, ...) => return1, return2, ...``
* STORE_RECORD will be saved before calling the function and will be restored when the function has been finished.
* Exception: the defined function call parameter and function return values will be filled and processed via STORE_RECORD.
* Inside the QFQ function, all STORES are available.
* The function has only access to STORE_RECORD variables which has been explicitly defined in the braces (var1, var2, ...).
* The function return values will be copied to STORE_RECORD after the function finished.
* Inside the QFQ function, all other STORES are fully available.
* If ``
<level>
.function`` and ``
<level>
.sql`` are both given, ``
<level>
.function`` is processed first.
* If ``
<level>
.function`` is given, but ``
<level>
.sql`` not, the values of ``shead, stail, althead`` are processed.
* If ``
<level>
.function`` is given, but ``
<level>
.sql`` not, the values of ``shead, stail, althead`` are
even
processed.
* If a function outputs something, this is *not* shown.
* The output of a QFQ function is accessible via ``{{_output:R}}``.
* It is possible to call functions inside of a function.
...
...
@@ -1969,7 +1970,7 @@ Example tt-content record for the function::
#
render = api
10 {
10
0
{
sql = SELECT p.firstName AS _firstName
, NOW() AS now, CONCAT('p:{{pageAlias:T}}
&
form=person
&
r=', p.id ) AS '_pagee|_hide|myLink'
FROM Person AS p
...
...
@@ -2003,6 +2004,15 @@ Example tt-content record for the calling report::
}
}
Explanation:
* Level 10 iterates over all `person`.
* Level 10.20 calls QFQ function `getFirstName()` by delivering the `pId` via STORE_RECORD. The function expects the return
value `firstName` and `myLink`.
* The function selects in level 100 the person given by ``{{pId:R}}``. The `firstName` is not printed but a hidden column.
Column ``now`` is printed. Column 'myLink' is a rendered link, but not printed.
* Level 10.30 prints the return values ``firstName`` and ``myLink`` (as rendered link and as source definition). The last
column is the output of the function - the value of ``NOW()``
.. _download:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment