* Save values of a form to different record(s), optionally on different table(s).
* Typically usefull on 'afterSave'.
* Typically usefull on 'afterSave' - be carefull when using it earlier, e.g. beforeLoad.
FormElement.’‘’parameter’‘’:
...
...
@@ -969,11 +969,14 @@ Types:
`action`-FormElement will be processed.
* ‘’‘slaveId‘’‘:
* If `slaveId` does not exist or is empty (e.g. a defined query has an empty result):
* If there is a primary table column, with the same name as the current `action`-FormElement: take the value from that column as `slaveId`.
* If not: treat it as '0'.
* A value of `0` means the following `sqlInsert` will be fired.
* A value > `0` means the following `sqlUpdate` will be fired and the `slaveId` specifies which one.
* If there is no `slaveId` defined and if there is a column name with the same name as the current `action`-FormElement:
take the value from that column as `slaveId`.
* Access the `slaveId` by using the variable `{{slaveId:V}}` inside of `sqlUpdate` or `sqlInsert`.
* Access the `slaveId` by using the variable `{{slaveId:V}}` inside of `sqlUpdate`, `sqlInsert` or `sqlDelete`.
* ‘’‘sqlUpdate‘’‘ - query. E.g.: `sqlUpdate={{UPDATE Address SET street = '{{street:F:all}}' WHERE id={{slaveId:V}} LIMIT 1}}`
* ‘’‘sqlInsert‘’‘ - query. E.g.: `sqlInsert={{INSERT INTO Address (pId, street) VALUES ( {{id:R}}, '{{street:F:all}}' WHERE id={{slaveId:V}} }}`
...
...
@@ -2111,11 +2114,11 @@ Formatting Examples
Formating (i.e. wrapping of data with HTML tags etc.) can be achieved in two different ways:
One can add formatting output directly into the SQL by either putting it in a separate column of the output or by using concat to concatenate data and formatting output in a single column.
One can add formatting output directly into the SQL by either putting it in a separate column of the output or by using concat to concatenate data and formatting output in a single column.
One can use ?level keys to define formatting information that will be put before/after/between all rows/columns of the actual levels result.
One can use ?level keys to define formatting information that will be put before/after/between all rows/columns of the actual levels result.
Two columns
Two columns
::
...
...
@@ -2127,7 +2130,7 @@ Formating (i.e. wrapping of data with HTML tags etc.) can be achieved in two dif
Result:
Result:
::
...
...
@@ -2141,7 +2144,7 @@ Formating (i.e. wrapping of data with HTML tags etc.) can be achieved in two dif
One column 'rend'
One column 'rend'
::
...
...
@@ -2151,9 +2154,7 @@ Formating (i.e. wrapping of data with HTML tags etc.) can be achieved in two dif
..
Result:
Result:
::
...
...
@@ -2165,9 +2166,7 @@ Formating (i.e. wrapping of data with HTML tags etc.) can be achieved in two dif
..
More HTML
More HTML
::
...
...
@@ -2180,9 +2179,7 @@ Formating (i.e. wrapping of data with HTML tags etc.) can be achieved in two dif
..
Result:
Result:
::
...
...
@@ -2207,7 +2204,7 @@ The same as above, but with braces::
::
Two queries
Two queries
::
...
...
@@ -2219,9 +2216,7 @@ The same as above, but with braces::
..
Two queries: nested
Two queries: nested
::
...
...
@@ -2252,7 +2247,7 @@ Two queries: nested with variables
..
* For every record of '10', all assigned records of 10.10 will be printed.
* For every record of '10', all assigned records of 10.10 will be printed.
Two queries: nested with hidden variables in a table
...
...
@@ -2346,14 +2341,14 @@ unchanged.
* Primary form, `subrecord` formelement, field `parameter`: set
::
::
detail=id:formId,{{SELECT '&', IFNULL(fe.ord,0)+10 FROM Form AS f LEFT JOIN FormElement AS fe ON fe.formId=f.id WHERE f.id={{r:S0}} ORDER BY fe.ord DESC LIMIT 1}}:ord
detail=id:formId,{{SELECT '&', IFNULL(fe.ord,0)+10 FROM Form AS f LEFT JOIN FormElement AS fe ON fe.formId=f.id WHERE f.id={{r:S0}} ORDER BY fe.ord DESC LIMIT 1}}:ord
* Secondary form, `ord` formelement, field `value`: set
::
::
`{{RS0}}`.
...
...
@@ -2364,15 +2359,17 @@ Compute the next 'ord' as default value direct inside the secondary form. No cha
* Secondary form, `ord` formelement, field `value`: set `{{SELECT IF({{ord:R0}}=0, MAX(IFNULL(fe.ord,0))+10,{{ord:R0}}) FROM (SELECT 1) AS a LEFT JOIN FormElement AS fe ON fe.formId={{formId:S0}} GROUP BY fe.formId}}`.
Form: Person Wizard
-------------------
Form: Person Wizard - firstname, city
-------------------------------------
Requirement: A form that displays the column 'firstname' from table 'Person' and 'city' from table 'Address'. If the