... |
... |
@@ -1,9
+1,9 @@ |
1 |
1 |
{{content/}} |
2 |
2 |
|
3 |
|
-Database queries are similar to [[data sources>>doc:Sources]] (XML, CSV, JSON). The important difference is that they are not static, but read dynamically from a database. |
|
3 |
+Database queries are similar to [[data sources>>doc:Quellen]] (XML, CSV, JSON). The important difference is that they are not static, but read dynamically from a database. |
4 |
4 |
|
5 |
5 |
{{info}} |
6 |
|
-Before you can create a new database query, you must create a [[database connection >>doc:DBConnections]] if you have not done so already. |
|
6 |
+Before you can create a new database query, you must create a [[database connection >>doc:Verbindung]] if you have not done so already. |
7 |
7 |
{{/info}} |
8 |
8 |
|
9 |
9 |
== Creating a database query == |
... |
... |
@@ -32,24
+32,24 @@ |
32 |
32 |
|name|Must match the name of the database query.|Yes |
33 |
33 |
|clientName|Must match the name of the client used for creating this data source.|Yes, if //projektId// is not given |
34 |
34 |
|projektId|Must match the ID of the form. This information can be seen by accessing the {{code language="javascript"}}XFC_METADATA.currentProject.id{{/code}} object from JavaScript.|Yes, if //mandantName// is not given |
35 |
|
-|sqlParameter|Alias for //queryParameter//. This is deprecated from version 6 and should not be used anymore. It may be removed in future releases.| |
|
35 |
+|sqlParameter|Alias for //queryParameter//. This is deprecated from version 6 and should not be used anymore. It may be removed in future releases.|\\ |
36 |
36 |
|queryParameter|Yes, if placeholders ( ? ) are used in the query. Must be a comma separated list of parameters and match the number of parameters used in the SQL query (from version 6).|No |
37 |
37 |
|varName|Allows you to change name of the JSON response object. If not given, a plain JSON object with the result data is returned.|No |
38 |
38 |
|delimiter|The delimiter for the placeholder values, see //queryParameter//. Defaults to a comma {{code}},{{/code}}|No |
39 |
39 |
|
40 |
|
-When accessing a database servlet from a form, always use the database URL contained in the global object //XFC_METADATA//, see also the [[form-specific JavaScript objects>>doc:Formcycle.FormDesigner.ScriptMetaAndCssTabs.ScriptTab.FormSpecificJavaScriptObjects]]. For example: {{code language="javascript"}}XFC_METADATA.urls.datasource_db{{/code}}. |
|
40 |
+When accessing a database servlet from a form, always use the database URL contained in the global object //XFC_METADATA//, see also [[global designer variables>>doc:Formular-Metadaten]]. For example: {{code language="javascript"}}XFC_METADATA.urls.datasource_db{{/code}}. |
41 |
41 |
|
42 |
|
-Further we recommend you use the script function [[getDataQuery>>doc:Formcycle.FormDesigner.ScriptMetaAndCssTabs.ScriptTab.AdditionalScriptFunctions.GetDataQuery]], so you do not have to setup the servlet request manually. The result of the database query is returned as //JSON//. |
|
42 |
+Further we recommend you use the script function [[getDataQuery>>doc:Zusaetzliche_Script-Funktionen.jQuery\.xutil\.getDataQuery()]], so you do not have to setup the servlet request manually. The result of the database query is returned as //JSON//. |
43 |
43 |
|
44 |
44 |
== Selection form elements == |
45 |
45 |
|
46 |
|
-If you want to display the returned data as options of a [[selection element>>doc:Formcycle.FormDesigner.FormElements.Selection]], you can do so easily by opening the {{designer/}} and selecting the database query as the data source of the selection element. |
|
46 |
+If you want to display the returned data as options of a [[selection element>>doc:Auswahl]], you can do so easily by opening the {{designer/}} and selecting the database query as the data source of the selection element. |
47 |
47 |
|
48 |
48 |
{{figure image="002En.png"}} |
49 |
49 |
Setting up a selection element with data from a database query. Just select the database query as the data source. |
50 |
50 |
{{/figure}} |
51 |
51 |
|
52 |
|
-The result of the database query is used to create the options of the [[selection element>>doc:Formcycle.FormDesigner.FormElements.Selection]] in the following order: |
|
52 |
+The result of the database query is used to create the options of the [[selection element>>doc:Auswahl]] in the following order: |
53 |
53 |
|
54 |
54 |
{{box}} |
55 |
55 |
Displayed value, submitted value, optional value 1, optional value 2, ... |
... |
... |
@@ -71,24
+71,18 @@ |
71 |
71 |
select name, first_name from table where first_name like (?) |
72 |
72 |
{{/code}} |
73 |
73 |
|
74 |
|
-This SQL statement returns the names of all persons with a certain first name. The first name to search for is specified via an URL parameter. |
|
74 |
+Abfrage per Servlet: {{code}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&sqlParameter=Robinson{{/code}} |
75 |
75 |
|
76 |
|
-URL for running the query: {{code}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&sqlParameter=Robinson{{/code}} |
77 |
77 |
|
78 |
|
- |
79 |
79 |
{{code language="sql"}} |
80 |
80 |
select name, first_name from table where id = ? |
81 |
81 |
{{/code}} |
82 |
82 |
|
83 |
|
-Retrieves the name of a person with a certain ID. The ID is given as an URL parameter. |
|
81 |
+Abfrage per Servlet: {{code}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&sqlParameter=100{{/code}} |
84 |
84 |
|
85 |
|
-URL for running the query: {{code}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&sqlParameter=100{{/code}} |
86 |
86 |
|
87 |
|
- |
88 |
88 |
{{code language="sql"}} |
89 |
89 |
select name, first_name from table where city like(?) AND zip = ? |
90 |
90 |
{{/code}} |
91 |
91 |
|
92 |
|
-Retrieves the names of all persons that live in certain city. The city and the ZIP code are given as URL parameters. |
93 |
|
- |
94 |
|
-URL for running the query: {{code}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&sqlParameter=Paris,75001{{/code}} |
|
88 |
+Abfrage per Servlet: {{code}}http://myserver/formcycle/datenquelledb?mandantName=myself&name=demo&sqlParameter=Paris,75001{{/code}} |