Changes for page Zähler


From version 1.8
edited by gru
on 19.08.2021, 11:05
Change comment: There is no comment for this version
To version 1.26
edited by gru
on 31.08.2021, 10:49
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,13 +1,13 @@
1 1  {{content/}}
2 2  
3 3  {{id name="fig_counter"/}}
4 -{{figure image="counter_de.png"}}Configuration interface for creating counters: (1) list of existing counters, (2) area for editing the selected counter, (3) metadata of the counter.{{/figure}}
4 +{{figure image="counter_en.png" clear="h1"}}Configuration interface for creating counters: (1) list of existing counters, (2) area for editing the selected counter, (3) metadata of the counter.{{/figure}}
5 5  
6 6  The values of the counters can be changed with the action [[Change counter>>doc:Formcycle.Designer.Workflow.Actions.ModifyCounter]] and read out via [[variables>>doc:Formcycle.UserInterface.Variables]] and thus used in [[conditions>>doc:Formcycle.Designer.Workflow.FlowControl.Condition]], for example.
7 7  
8 8  == Creating a counter ==
9 9  
10 -Öffnen Sie das Modul "Daten > Zähler" und klicken Sie auf die Schaltfläche "Neu" {{ficon name="plus-circle-outline"/}} in der Kopfzeile der Liste (siehe Punkt 1 in der [[Abbildung>>||anchor="fig_counter"]]). Daraufhin können die entsprechenden [[Einstellungen>>||anchor="HKonfigurationsoptionen"]] für den Zähler getroffen werden und der Zähler ist. Mit einem Klick auf die Schaltfläche //Speichern// wird der Zähler angelegt.
10 +Open the "Data > Counter" module and click the "New" button {{ficon name="plus-circle-outline"/}} in the header of the list (see point 1 in [[figure>>||anchor="fig_counter"]]). Then the appropriate [[settings>>||anchor="HKonfigurationsoptionen"]] for the counter can be made. With a click on the //Save// button the counter is created.
11 11  
12 12  == Configuration options ==
13 13  
... ... @@ -33,18 +33,88 @@
33 33  ::; at
34 34  ::: Time at which the reset should take place. Only available if //daily//, //weekly//, //monthly// or //annually// is selected as condition.
35 35  ::; On days
36 -::: Wochentag, an dem das Zurücksetzen stattfinden soll. Nur verfügbar, wenn //wöchentlich// als Bedingung ausgewählt wurde.
36 +::: Day of the week on which the reset should take place. Only available if //weekly// is selected as condition.
37 37  ::; Day of the month
38 -::: Tag in Monat, an dem der Zähler zurückgesetzt werden soll. Nur verfügbar, wenn //monatlich// oder //jährlich// als Bedingung ausgewählt wurde.
38 +::: Day in month on which the counter is to be reset. Only available if //monthly// or //yearly// is selected as condition.
39 39  ::; Month
40 -::: Monat, in dem der Zähler zurückgesetzt werden soll. Nur verfügbar, wenn //jährlich// als Bedingung ausgewählt wurde.
40 +::: Month in which the counter is to be reset. Only available if //annual// is selected as condition.
41 41  
42 -Unter den Einstellungen werden zudem die folgenden Informationen unter //Zähler-Metadaten// angezeigt:
42 +The following information is also displayed under the settings in //Counter meta data//:
43 43  
44 44  ; UUID
45 -: Systeminterne UUID des hlers
45 +: System internal UUID of the counter
46 46  ; Angelegt am
47 -: Zeitpunkt, an dem der hler erstellt wurde
47 +: Time when the counter was created
48 48  ; Geändert am
49 -: Zeitpunkt, an dem zum letzten Mal Änderungen am hler vorgenommen wurden
49 +: Time when changes were last made to the meter
50 50  
51 +== Variables ==
52 +
53 +The values of counters can be read out via [[variables>>doc:Formcycle.UserInterface.Variables]], for example in the workflow or as values of form elements. The syntax is as follows:
54 +
55 +{{code language="none"}}[%$COUNTER_CLIENT.<name of the counter>%]{{/code}}
56 +
57 +
58 +== Access of counter value via servlet ==
59 +
60 +=== Servlet {{smallcaps}}URL{{/smallcaps}} and parameters ===
61 +
62 +The value of the counters can be determined within forms via a servlet call. It is possible to select the counter by its name or UUID. The corresponding {{smallcaps}}URL{{/smallcaps}}s for calling the values could look like the following, for example:
63 +
64 +{{code language="none"}}https://<server address>/formcycle/form/clientcounter/?frid=<Valid frid>&name=<name of the counter>{{/code}}
65 +and
66 +{{code language="none"}}https://<server address>/formcycle/form/clientcounter/?frid=<Valid frid>&uuid=<UUID of the counter>{{/code}}
67 +
68 +
69 +In both cases a valid //form request id// (frid) is required, which can be found in the form via JavaScript under {{code language="none"}}XFC_METADATA.currentSessionFRID{{/code}}. In the same way, the {{smallcaps}}URL{{/smallcaps}} of the servlet can be read via JavaScript under {{code language="none"}}XFC_METADATA.urls.counter_client{{/code}}. This is important because the {{smallcaps}}URL{{/smallcaps}} differs when called from frontend and master servers.
70 +
71 +=== Return values ===
72 +
73 +The result is returned as JSON. Besides the actual value, other information is also returned. The response has the following structure:
74 +; success
75 +: Boolean value that indicates whether the meter value could be read successfully.
76 +; msg
77 +: Server message related to the request, which can be used for debugging. A successful access returns e.g. //Counter found//.
78 +; result
79 +: Response to the request. If the request was not successful, only an empty JSON object literal is returned. On the other hand, if the request was successful, the following sub-items are included in the JSON object literal:
80 +:; lastChange
81 +:: Formatted output of date and time of the last change of the counter value
82 +:; lastChangeTimestamp
83 +:: Epoch of the last change of the counter value
84 +:; name
85 +:: Name of the counter
86 +:; uuid
87 +:: UUID of the counter
88 +:; value
89 +:: Current counter value
90 +
91 +=== Example of an AJAX request in a form ===
92 +
93 +An example AJAX request that writes the current counter value of the //sample counter// to the //tf1// field might look like the following:
94 +
95 +{{code language="javascript"}}
96 +$.ajax({
97 + method: "GET",
98 + url: XFC_METADATA.urls.counter_client,
99 + data: {
100 + name: "Examplecounter",
101 + frid: XFC_METADATA.currentSessionFRID,
102 + }
103 +}).then(function(data) {
104 + if (data.success) {
105 + $('[data-name="tf1"]').val(data.result.value);
106 + } else {
107 + console.warn("Access to counter 'Examplecounter' failed:", data.msg);
108 + }
109 +}).catch(function(jqXHR, errorTextStatus, errorThrown) {
110 + console.warn("Access to counter 'Examplecounter' failed:", errorThrown, "(" + errorTextStatus + ")");
111 +});
112 +{{/code}}
113 +
114 +=== Inserting a template for an AJAX request in the form ===
115 +
116 +{{figure image="counter_query_en.png"}}Selection of the template for the counter query in the JavaScript area of the form designer.{{/figure}}
117 +
118 +A template similar to the above example function can be inserted directly in the JavaScript area of the Form Designer using Autocomplete. To do this, enter {{code language="none"}}Counter query{{/code}} (or at least {{code language="none"}}Counter{{/code}}) one after the other in the JavaScript area and select and confirm the //Counter query// option suggested by Autocomplete with a click or with the Arrow keys and the Enter key.
119 +
120 +After the template is inserted, the required functionality must be added and the name of the counter must be changed.