diff --git a/Documentation/Variable.rst b/Documentation/Variable.rst index 0f58273e66717d055883eadf79cf6d96584f632f..b8ec6e1601e3c6d556b17415542a861ccfdb1f44 100644 --- a/Documentation/Variable.rst +++ b/Documentation/Variable.rst @@ -44,7 +44,7 @@ provided. Access to: * :ref:`store-variables` * :ref:`sql-variables` * :ref:`row-column-variables` -* :ref:`link-column-variables` +* :ref:`link-function-column-variables` Some examples, including nesting:: @@ -72,6 +72,12 @@ Some examples, including nesting:: # Link Columns {{p:form=Person&r=1|t:Edit Person|E|s AS link}} + # Function Columns + {{getFullname(pId) => fullname AS function}} + + # Function Columns > direct tt_content output + {{getFullname(pId) AS function}} + Leading and trailing spaces inside curly braces are removed. * ``{{ SELECT "Hello World" }}`` becomes ``{{SELECT "Hello World"}}`` @@ -421,10 +427,13 @@ General note: using this type of variables is only the second choice. First choi :ref:`access-column-values`) - using the STORE_RECORD is more portable cause no renumbering is needed if the level keys change. -.. _`link-column-variables`: +.. _`link-function-column-variables`: -Link column variables ---------------------- +Link/Function column variables +------------------------------ + +Link column +^^^^^^^^^^^ These variables return a link, completely rendered in HTML. The syntax and all features of :ref:`column-link` are available. The following code will render a *new person* button:: @@ -435,7 +444,38 @@ For better reading, the format string might be wrapped in single or double quote {{"p:form&form=Person|s|N|t:new person" AS link}} -These variables are especially helpful in: + +Function column +^^^^^^^^^^^^^^^ + +These variables execute a qfqFunction:: + + // Report with qfqFunction. Subheader: getFullname + render = api + 10 { + sql = SELECT CONCAT(lastName, ', ', firstName) AS _fullname + FROM Person + WHERE id = {{pId:R0}} + } + + // Usage function column + {{getFullname(pId) => fullname AS function}} + {{SELECT '{{fullname:RE}}'}} + +Usually it is preferred to get the output from a function without using the variable {{_output:RE}}:: + + // Report with qfqFunction. Subheader: getFullname + render = api + 10 { + sql = SELECT CONCAT(lastName, ', ', firstName) + FROM Person + WHERE id = {{pId:R0}} + } + + {{getFullname(pId) AS function}} + + +These two column variables are especially helpful in: * `report`, to create create links or buttons outside of an SQL statement. E.g. in `head`, `rbeg`, ... * `form`, to create links and buttons in labels or notes.