Script¶
Configuration Scripting¶

Key name |
Input |
Meaning |
---|---|---|
Serverscript cycle time |
Default value: 500 |
Script cycle time in milliseconds |
Clientscript cycle time |
Default value: 200 |
Script cycle time in milliseconds |
Number of incorrect script runs |
Default value: 10 |
This defines the number of times the script is run with hard errors |
Copy structures |
Default value: yes |
Defines, if structures will be copied when allocating |
Sharing pocess variables after running the script |
Default value: no |
After running the scripht, the registered process variables will be deallocated. |
Always release process variables after data management |
Default value: no |
After calling the data management functions, the registered process variables will be deallocated. |
Tasks of the plug-in script¶
PROCON-WEB allows scripts to be edited parallel to the running visualization.These formulas are not a substitute for control, but mainly cover the following tasks:
Support of the visualization by preparing process data (e.g., generating summarized status information)
Supplementary-controlled processing of complex functions (e.g., data acquisition, alarms, screen changes, calculations)
Simulation of processes by changing internal parameters
Plausibility checks over several dependent setpoints
Time-controlled processing of functions
Call up your own high-level language programs
Release 6.8 differentiates between server and client scripting.As the name suggests, scripts can now be sent directly to run on a client. They run in a WebWorker and are thus encapsulated by the actual WebRuntime. In contrast to Server scripts, client scripts are written in TypeScript.
Clientscripting¶
General¶
The scripts are written in TypeScript ES6 Module.
In the scripts you have access on the tags like with dynamic expressions.
You can write the value of the variable directly
Functions have to be exported whenever you want to use them outside of the actual script. (e.g. integration into another script-file, assign a script function to a button, or append of a cyclic image script)
In the transfer parameters of the exported functions are the allowed types exclusively number, string or boolean.
Union types and overloads are allowed. These are then individually selectably resolved.
The calling of browser specific APIs (e.g fetch, setTimeout) as well asthe manipulation of DOM-elements with Clientscripting is not allowed.
Import of other scripts is with relative paths possible.
Creating a Clientscript¶
With the right mouse button in the context menu of the project tree, a new client script will be created.
The following are some pointers on how to create a client scripts.However, since it is a standardized language, it is recommended to provide additional information or parts of code using a Internet research.
Create a function
To create a function, you can use the following syntax:
function nameofthefunction(par1,par2,…) { //code } Important: If you want to use this function outside of the script (e.g. assign to a Button), then the keyword export must be completed.
export function nameDerFunktion(par1,par2,…) { //code
Create variables
The special thing about Typescript is, that you don’t necessarily have to use a data type. Typescript does this on its own. If you want to declare variables or constantswithin a script, you can do this with the following syntax:
Creation within a function (local)
- export function myFunction() {
//Declaration of constants const VARIABLESTRING : string = “This is a string”; const VARIABLENUM : number = 123; const VARIABLEBOOL : boolean = true;
//Declaration of variables let variableString : string = “Das ist String”; let variableNum : number = 123; let variableBool : boolean = true;
} Creating outside of a funtion (global):

Create variables
One-line comment with: // Multi-line comment with: /* */
Comment on area: highlight the area and then: SHIFT +ALT + A
- export function myFunction() {
This is a one-line comment.
This is a multi-line comment.
Assignment of the script function to objects (e.g. button)
Creation and integration of a CS function, e.g. for button differenceswhen calling functions with different types
Code example for union types: With selection of functions etc
demonstrate transfer parameters
Import from other scripts
Here it is important, that the relative path starts always with:„./“(Skript and is in the same folder or further down
Picture-Scripts
It is also possible to call a script function cyclically. In contrast for server scripting, a function and not a script must be specified here In the future, the When functions from the same script are called cyclically, and also when the image open/close event the script function is used in the Always open the image before the first cyclic pass and the Close event always after the last run. Are used in the open/close event functions are called in other scripts, so the order of execution has not been ensured. If an image is opened and closed again immediately afterwards it can happen that there is no cyclical run.

When it comes to functions, you can now execute client script functionality as an actionbe determined. Here, the script, the function and the parameters be specified.
Converter from Pascal to TypeScript
In the designer there is the possibility to convert old Pascal code to TypeScriptThis can be done via the context menu in the tree for a server script.
If the script has been successfully converted, it will open afterwards.If an error occurs during the conversion, a message is displayedHere you have to check whether the server script can be translated at all. The original script will not be deleted.
There is no automatic assignment of the converted script to images or image elements (e.g. button). Has a script that shall be converted dependencies, then these must also be converted manuallyOnce converted, the functionality of the scripts must be checked. This is necessary because not all language constructs of a server script can be copied into a client script. The converter always tries to find the best solution here.
After converting, the script may still have errors. This then has to be fixed manually. Has been a function of the ServerSkrpt API that does not exist in the client script, or the converter not supported, then a dummy method that throws an error on Placed at the beginning of the script. Here you can use the functionality re-implemented or the script has to be rebuilt in such a way that the Function is no longer required.
The converter is designed to translate server scripts that are already in place in existing projects. He doesn’t carry out any verificationby whether the server script is valid at all. In the event of an invalid server script, the conversion may failor or an invalid Client script will be generated.
Client Script V0 Api
- The first API (V0) is now availabel in the Clientscripting. The APIis related to the function in the Serverscripting.
The syntax for calling differs from the one used in the serverscripts.
Furthermore, the API is located under the namespace “pweb.v0.scripting”. Tocall a userLogin, “pweb.v0.scripting.login(username, password)”. Before each API call the changed tags will be written to the web runtime.An API call always returns a promise, which starts with “await” needs to be maintained. While using await on the response an API function is maintained, a different script may run. If the answer of that API function comes back, the tags from the Read WebRuntime are read again. IntelliSense can be used for syntax.

fillImageView
specialFunction
addLogbookEntry
setLanguage
getLanguage
openNewBrowserWindow
openNewBrowserTab
changePicture
openPicture
closePicture
printPicture
changeAllPictures
fillPictureArea
login
logout
createUser
deleteUser
setUserPassword
getUserGroup
addUserToGroup
removeUserFromGroup
getUserInfo
setUserInfo
Undo/Redo The editor includes its own UndoRedo stack which is not synchronized with the designer’s. So if you change in a clientscript a script, there is no entry for undo/redo in the Designer. An exception to this are actions that affect other areas in the designer. Currently, these are the following:
Rename tag/process variable (via F2 in the CS-Editor)
Rename already exported functions (via F2 in the CS-Editor)
Note
If there are errors (no warnings!) in a script, it can be that warnings cannot be displayed because the Compiler can’t correctly determine if it’s displaying a warning or not. A blank line within a while loop is defined as Warning detected, an invalid string is not.
Runtime¶
At runtime, all tags that are in a script (including imported ones) can be requested on the TagServer. A script is only executed, when a first read from the TagServer (not from the controller) is started.
If the same script (doesn’t have to be the same function) is started multiple times, is will be ensured, that the scripts will be executed in the correct order. For different scripts that isn´t ensured.
System alarms
Numbers |
Text |
Meaning |
---|---|---|
9500100 |
WebRuntime: Clientscript couldn´t be loaded - check browser version |
Error within export or browser version |
9500101 |
WebRuntime: Clientscriptfunction was not found |
Function does not exists |
9500102 |
WebRuntime: Unhandled error in the clientscript |
Error in the try-catch block |
9500103 |
WebRuntime: Invalid access on tags in the clientscript |
Access on not existing tag |
Security note
Because client scripts don’t run on the server, but in the browser, it can theoretically - just like any other JavaScript code that isrunning in the browser - be manipulated.
Debugging
The scripts can be “debugged” by the browser via the normal debuggerIn the future, the The scripts are located under the “clientsScripts” and there under the URL “clientscript://”. Here are source maps for the scripts so that the original Typescript code can be displayed and not the translated JavaScript code.
It is recommended to debug in the options of the Chrome/Edge Debuggerfrom the ClientScriptRuntime.js. To this end, the ClientScriptRuntime.js file at custom exclusion rules should be added.
Serverscripting¶
Structure of the scripts in the project¶
There are three different types of script execution under PROCON-WEB:
Tasks that are processed cyclically during runtime (e.g., global script).
Image-specific scripts that are processed cyclically at the time the image is displayed
Scripts that click on buttons or events, for example: opening or closing picturesAll scripts are stored in the project database and edited in the designer.
Processing of the events¶
Before the scripts are processed, the script server checks for which scripts in the tasks the condition is true and then processes them cyclically. The cycle time tells us when the script will be executed next. Please note that the scripts are executed as little as possible and as often as necessary based on the cycle times. The lower the cycle time is set, the more often the script is executed.
In PROCON-WEB, the scripts can now be assigned to buttons and images as independent scripts.
Creating and compiling the scripts¶
The designer automatically creates the global script and a cyclic task with 100 ms when creating a new project. Image-oriented scripts are now normal scripts that are assigned to the image via the image class. The scripts can be used in tasks, in pictures as picture scripts or when opening / closing pictures.All scripts available in the project can be selected in the project tree in the plug-in script.
Alle im Projekt vorhandenen Skripts sind im Projektbaum im PlugIn Skript wählbar.
Important
Script names must begin with a letter and cannot contain any special characters other than the underscore ‘_’.
Important
Picture-oriented scripts of not visible pictures will also be executed.
To assign a script as a picture-oriented script to a picture, the corresponding script is selected via the picture’s class dialog.

Scripts on pictures (cyclic picture-oriented script) are processed in the following situations:
Open picture (via button for example)
Switch an opened picture invisible
Switch a picture area invisible in which the picture is embedded
Empty a picture area invisible in which the picture is embedded
In case of the picture-closing event, picture-oriented scripts are not processed
Create tasks¶
Tasks can be used to execute scripts in the ScriptServer cyclically or event controlled.When creating a new project, the designer automatically creates a global task that is to process the global script cyclically with 100ms.

A task requires a name, optionally a description, and a script that this task is to execute.You can also define whether the task should run cyclically, or event driven.
Important
The minimum cycle time of a task is 100 ms
The parameterisation of the event-controlled tasks takes place in the same way as in the picture montage.
Since the scripts are client-related, they are each written in the context of the Executed on the corresponding clients. This means using local variables are the variables of the respective client, the logged-in users, the corresponding client user, etc.
The scripts run per client, so if there are several registered clients also use the scripts accordingly for EACH Client running.
Client Start
The task condition “Client Start” executes the stored script if a client logs on to the system for the first time. The script is opened when the Clients and then runs once in the background. The client does not wait for the script to finish at startup. At a long-running client Start Script can be used by the client before the script has been completely processed.
Should the client only allow certain actions AFTER the script has been terminated, this must be done, for example, by setting a Process variables at the end of the script, which the client then refers tocan react accordingly.
Client Cycle
The task condition “Client Cycle” executes the stored script cyclically for each logged in client. The script is created in a similar way to global cyclic scripts always replay after the interval timetriggered. If the script runs longer than the interval time, it becomes direct is then triggered again. There is only one script running per client at a timeat a time, i.e. the next script call will be executed until the end of the previously delayed or ignored the call directly if the identicalScript is currently running.
Startup and shutdown events
In addition to the tasks mentioned above, tasks for the system start and system stop can also be defined.This means that scripts can now be executed when starting runtime (more precisely when starting the script server) and when exiting runtime.
Several startup and shutdown scripts can be defined; these are then processed in sequence.
Startup scripts every time the server transitions to running.
Shutdown scripts every time when transitioning from running to break.
Important
The startup script can be used for initialization tasks, for example.
This can replace the old pattern in the global script:
PROGRAM
BEGIN
Init()
while(1) do …
END
The content of Init () can now be defined as a stand-alone script and used as a startup script.
Important
The shutdown script is executed when the service is shut down.
The SystemServer ensures that the dependent function servers (TagServer, DataServer, AlertServer) are still running. But now the web server may have already been shut down and no clients are logged on to the system. Client-related script functions (open picture, …) can therefore fail.
Syntax serverscripts¶
Overview
A separate language was defined, which is based on the PASCAL syntax. The language allows block formation, control structures, loops, and functions for a modular structure of the program.
All instructions are line-oriented to dispense with terminator symbols for instructions. The line length is set to 255 characters. Comments are possible anywhere in the source code. Function values do not have to be specified when the function is called, even if the called function requires a value.
The language includes the basic arithmetic operations of addition, subtraction, division, multiplication, integer division and remainder. Likewise, the comparison operators =, <> or! =, <=,> =,>, <.
The language includes the binary operations NOT, AND, OR, XOR, SHL, SHR.
The language allows a local definition of variables of the simple types Boolean, Integer, Real, String.
The language has a standard set of functions for easy integration of user functions.
The language allows the specification of constants of the types Boolean, Integer, Real, String.
The compiler differentiates between upper and lower case.
The language knows all process values of a project as variables of the type Boolean, Real and String (note one-dimensional fields).
The language allows a maximum of 5 block nesting.
The language allows a maximum of 5 levels of brackets.
The language does not allow function definitions in functions.
The language does not allow semaphores (formulas cannot be synchronized).
The following table explains the order of precedence of the operators.
Rang |
Operator |
---|---|
not |
|
*, /, div, mod, and, shl, shr |
|
+, -, or, xor |
|
=, <, >, <>, <=, >= |
Operators of higher precedence are executed first. If operators have the same rank, the execution is carried out from left to right. For example, “*” is executed before “div”, not is executed before “*” and “div”.
Important
Division of constants without “.” Are interpreted as integer values.In other words, with a division you have to work with decimal places, e.g. test = 15.00 / 3.00 instead of test = 15/3
Keywords |
Meaning |
---|---|
StackSize |
Stack size in bytes (max. 10000; default setting: = 4096) |
program |
Start of program |
import |
Imports another script |
Import ..as .. |
Imports another script with an alias name |
private |
Functions and variables defined with “private” cannot be imported |
. |
Dot operator to access functions and variables of imported scripts |
const |
Definition of constants Example: const Name = 100 (the name must be unique in the project, ie no names identical with variables). |
var |
Variable definition (always comes after the constant definition |
boolean |
Data type logical variable |
Integer |
Data type integer variable |
real |
Data type numeric variable |
text |
Data type file variable |
string |
Data type text variable |
begin |
Start of block |
if..then..else |
Control structure condition |
for..to..do |
Loop with incrementation (index only integer) (run variable of type: integer) |
for..downto..do |
Loop with decrementing (index only integer) (run variable of type: integer) |
while..do |
Loop with condition (run variable of type: Integer) |
not, and, or |
|
xor, shl, shr |
Binary operations (e.g. numvar: = numvar1 shl 2) |
mod, div |
Integer operations |
end |
End of block |
function |
Start of function |
exit |
Jumps out of the current function |
Syntax description¶
Important
Keywords are fixed terms and must not be used for constants or variables in formula code.
Terminal symbols |
|
---|---|
+, -, *, / |
Basic arithmetic |
(, ) |
Bracketing (5 bracket levels) |
(*, *) |
Short name |
<, >, <=, >=,<>, = |
Comparison mode |
: = |
allocation |
[] |
Field indexing |
. |
Decimal point |
’ |
String with max. 31 characters |
$ |
Hex-Symbol |
: |
Var-Trenner |
, |
Identifier |
Language elements
Meta symbols |
|
---|---|
|
T not terminal symbol |
{} |
optimal value repetition |
[] |
optimal |
Buchstabe |
A..Z |
Hex digit |
0..9 |
Hex digit |
Hex digit |
Numerical values |
|
---|---|
Hex digit |
$ <Hex digit> {<hex digit>} |
Integer |
[+ || -] <digit> {<digit>} |
Real value |
[+ || -]<digit> {<digit>}. <digit> {<digit>} |
Identifier |
<Letter> {<number || Letter>} |
Field identifier |
<Identifier> “[” <identifier || Integer || Hex digit> “]” |
Variable identifier |
<identifier> || <Field identifier> |
Function identifier |
<identifier> |
Constant declaration |
<identifier> = <hex digit|| Integer || Real value |
Result type |
boolean |
Variable declaration |
<Variable identifier> {“,” <variable identifier>}: <result type> |
Comment |
(* <Text> *) |
Stack size |
STACK <hex number` || Integer> |
Number of lines |
LINES <hex dgit|| Integer> |
program |
program <Block> |
Block |
[<Import declaration part>][<Constant declaration part>]|||[<Variable declaration part>][<Function declaration part>]<Command part> |
Command part |
Begin <Statement block> end |
Const. Declaration part |
const <Constant declaration> {<Constant declaration>} |
Variable declaration part |
var <Variable declaration> {<Variable declaration>} |
Function declaration part |
<Function head> <Function block> |
Functional head |
function identifier> [“(” <parameter list> “)”]: <result type> |
Parameter list |
<Variable declaration>|| var <variable declaration> {, <parameter list> |
Function block |
<Constant declaration part>] [<Variable declaration part>]<Function command part> |
Function command part |
Begin <Statement block>||<Function identifier>: = <expression>end |
factor |
<Variable identifier> || <constant identifier> || (<expression>) || <factor> || not <factor> || <Function call> || <external function> |
Term |
<factor> {(. || / || div || mod || and || shl || shr) <factor>} |
Function call |
<Variable identifier>: =] <function identifier> [(<function parameter>)] |
Note
The size of the variable pool (bytes) in a function must not exceed the stack size (default setting = 1024).The function parameters can also be of the ‘String’ data type.
Function parameters |
<Expression || Variable identifier> {, <function parameter>} |
simple expression |
<Term> { (+ || - || or || xor) <Term>} |
Expression |
<simple expression> {(<||> || <= ||> = || <> || =) <simple expression> |
Instruction |
<Compound statement> || <conditional statement> || <Repeat statement> || <assignment> || <Function call> |
Statement block |
<instruction> || <Statement block> |
Compound instruction |
Begin <instruction> {<instruction>} end |
conditional statement |
if <expression> then <instruction> [else <instruction>] |
Repeat instruction |
<while statement> || <for statement> |
while statement |
while <expression> do <instruction> |
for statement |
for <variable identifier>: = <expression> to || downto <expression> do <instruction> |
allocation |
<Variable identifier>: = <expression> |
General rules and instructions¶
Error handling
Im Skript Editor des Designers kann man in der Fehlerliste erkennen, ob es sich um eine Warnung oder um einen Fehler handelt. Dies funktioniert für Client- und Serverskripte. Wird ein gelbes “!”” angezeigt handelt es sich um eine Warnung. Bei einem Roten X um einen Fehler. Existieren Skripte mit Fehler kann nicht mehr exportiert werden. Bei Warnungen kann weiterhin exportiert werden. Es werden Fehler immer vor Warnungen angezeigt. Dies kann dazu führen, dass Warnungen nicht angezeigt werden, wenn direkt davor ein Fehler ist.
Subroutine call
With the help of event-local variables, process values can be transferred to a subroutine and the result returned to the main program.
(* 2 values are transferred to the “fnMinMax” subroutine in order to compare them. The result of the
function is returned to the main program using the function variable result1 or result2.
– Call by value –
The variables Pvar1, Pvar2, Pvar3 and minmax_bit are globally defined process variables. *)
Program
var Param1, Param2, Ergebnis1, Ergebnis2: integer
function fnMinMax(wert1 : integer, wert2 : integer, var result1, result2 : integer) : integer
begin
if wert1 > wert2 then
begin
result1:=wert1
result2:=wert2
end
else
begin
result2 := wert1
result1 := wert2
end
(*Assign function own return value*)
fnMinMax := (wert1+wert2) / 2
end
(* Main program *)
begin
if minmax_bit = 1 then
begin
minmax_bit :=0
(* Copy process variables to local transfer variables *)
Param1 := Pvar1
Param2 := Pvar2
(* Function call with function parameters *)
Pvar3:= fnMinMax(Param1, Param2, Ergebnis1, Ergebnis2)
(* Copy local result variables to process variables *)
Pvar1 := Ergebnis1
Pvar2 := Ergebnis2
end
end
Note
The content of a string variable cannot be passed to a function. In this case the pointer to the string variable must be transferred, i.e., a change in the function has a direct effect on the string variable itself -> Call by reference.
Constant and variable transfer parameters in the format “string”
The programming language in PROCON-WEB requires transfer parameters of the “String” type in many functions. These transfer parameters can be both variable and constant. Variable parameters are local or global text variables, constant parameters are texts in single quotation marks (‘xx’)
(* The CopyFiles function copies one or more files from a source directory to a target directory. The
source should be constant, the target should be defined via a variable. *)
PROGRAM
var ziel[20] : string
var return : integer
begin
ziel := 'c:\tmp\project.pcs'
return := CopyFiles('C:\PCSPRJCT\Project.pcs', ziel)
end
Note
The text variable “target” is defined locally, i.e. only valid in this function. You could also use a globally defined text variable (from the text variable editor of the picture assembly) and change it interactively, for example in a process picture.
Transiente variables
Transiente variables can now be declared, the value of which is reset to the default value after each “script run”.
This was the new keyword transient var introduced. This allows variables to be defined whose value is reset to the default after each script run.
In contrast, “normal” variables retain their value between script calls.The variable is reset in the following cases:
Event-oriented script (Global or client-specific): Before every single run of the script
Cyclic image script: When the picture opens. The variable then retains the value while the picture remains open. It is reset when it is closed and reopened
Cyclic global script: When the script is started initially (when the project starts) The variable then retains the value during the project runtime until the project is ended. In other words, for global cyclic scripts, a volatile variable behaves like a normal variable, so it makes no difference whether volatile is used or not
PROGRAM
var normalVar : integer
transient var volVar : integer
BEGIN
normVar := normVar + 1
volVar := volVar + 1
END
Script import functionality
In PROCON-WEB there is now the possibility to reference and use functions and global variables from other script files. Four new keywords have been added for this purpose.
Keywords |
|
---|---|
import |
Imports another script |
Import ..as .. |
Imports another script with an alias name |
private |
Functions and variables defined with “private” cannot be imported |
. |
Dot operator to access functions and variables of imported scripts |
Note
The import statement imports another script either by name or an alias
Important
The import statement MUST come directly after PROGRAM.
import <SKRIPTNAME>
import <SKRIPTNAME> as <ALIASNAME>
To hide certain variables and functions in the imported script, you can use the keyword private can only be defined for use within the script.
private var <VARIABLENNAME>
private function <FUNCTIONNAME>( … )
The use of the script names results in new restrictions for the script names:
Script names must be unique
Script names must not have the same name as process variables
Script names cannot be named like functions or variables within the script
Script names may only contain letters (A… Z || a … z || _) or numbers (0..9), no other special characters or umlauts
Otherwise, this leads to compiler errors
PROGRAM
var ExportVar : integer
private var TestVar : integer
function ExportFnc(input : integer) : integer
BEGIN
ExportVar := input
ExportFnc := input + 1
END
private function TestFnc() : integer
BEGIN
END
BEGIN
END
(* And here is a program that uses this script: *)
PROGRAM
import LibrarySkript as Lib
var testVar2,testVar3 : integer
BEGIN
testVar2 := Lib.ExportFnc(3)
testVar3 := Lib.ExportVar
END
The script is addressed via the alias “Lib”, the declared variable TestVar and the function TestFnc () can NOT be used for the script, because they are declared private.The ExportVar variable and the ExportFnc () function can, however, be used.
break and continue
There are now the two keywords break and continue, which can be used in loops.
Keywords |
|
---|---|
continue |
Cancels the current loop pass and continues with the next pass |
break |
breaks off the complete loop |
PROGRAM
var incr : integer
BEGIN
for incr := 0 to 30 do
begin
if (incr = 10) then
break
else if (incr = 20) then
continue
DefaultNumericVariable := incr
end
END
Division by 0¶
If a division by 0 is carried out in a script, the script is aborted with the system alarm 996611 (ScriptServer: Division by zero in script% s).
The script exits at the point where the error occurred, and the rest of the script’s code is no longer executed. The exchange of process variables, which normally takes place at the end of a script, does NOT take place either, i.e., the normally assigned and modified process variables of the script are retained at their value before the script is executed.
Exceptions are function calls that lead to process variable changes when they are called: Delay (), WriteToProcess (), Alert () and DBSend () / DBRecieve (), SetValue () and SetTagProperty ().
If these functions are called in the script BEFORE division by zero, the process variable exchange takes place correctly at this point. Any variable assignment after one of the above functions and subsequent division by zero will of course not be carried out.
PROGRAM
var zeroValue : Integer
BEGIN
TestPvar := 1 (*TestPvar is global variable *)
Delay(10) (* TestPvar is now 1 *)
TestPvar := 2
WriteToProcess(1) (* TestPvar is now 2 *)
zeroValue := 0
TestPvar := 10 / zeroValue (*DIVISION BY ZERO!!! Skript is aborted here*)
(*The following code is NEVER executed*)
WriteToProcess(1)
TestPvar := 3
WriteToProcess(1) (*TestPvar is still 2*)
END
Function description¶
The functions described below are firmly integrated functions that provide some of the services of the runtime system. Within the individual functions, it is defined whether this is also available in the IoT variant or only in SCADA.
Alphabetische Übersicht¶
Calculation of the absolute amount |
|
Conversion of time |
|
Add a picture |
|
Setting, acknowledging and resetting alarms |
|
Setting, acknowledging and resetting alarms |
|
Open an existing text file to append |
|
Function to append a number to a string and another string that can be used as a separator for concatenation |
|
Arccosine of an angle |
|
Arc sine of an angle |
|
Arc tangent of an angle |
|
Arctangent with two parameters of an angle |
|
Assigning a text file to a file variable |
|
Assigning a text file to a file variable |
|
Copying files asynchronously in the background |
|
Function to start the evaluation |
|
Function to start the evaluation |
|
Function for changing all pictures |
|
Function for changing the image |
|
Changes the current project |
|
Closing a text file |
|
Cloase an image |
|
Function for comparing two files for size or time stamp |
|
Copy a text file |
|
Cosine of an angle |
|
Hyperbolic cosine of an angle |
|
Creation of directories |
|
Create User |
|
Function for adding specific time periods to the absolute system time. |
|
Function for converting a date in string format to an absolute value |
|
Function for converting dates and times to a string |
|
Function for adding specific time periods to the absolute system time. |
|
Close the connection to the ODBC driver |
|
Function for copying a data record from a database. |
|
Function for copying a data record from one database to another database using the index data record. |
|
Function for deleting a data record from a database. |
|
Deleting records from the database using the record index |
|
Load data record from selected quantity |
|
The number of fields in a data record |
|
Define type of the data field” |
|
Function for searching for a data record with a certain name in a database. |
|
Read data elements from ODBC buffer |
|
Get error texts for the last ODBC error |
|
Determine the structure of a data element in the selected table |
|
Determine the number of selected data records and data elements |
|
Read time stamp from ODBC buffer |
|
Function to inform all clients (grids) about a change in the transferred data management. |
|
Establish a connection to the ODBC driver |
|
Connect to an ODBC data source |
|
Execute an ODBC procedure |
|
Change data elements from ODBC buffer |
|
Write time stamp from ODBC buffer |
|
Receive data records from the process for writing to the database |
|
Receive data records from the process for writing to the database using the data record index |
|
Change the status of a recipe |
|
Change the status of a recipe via the state index |
|
Change the version of a recipe |
|
Change the version of a recipe |
|
hange the name of a recipe |
|
Change the name of a recipe via the name index |
|
Read the name of a record from the database; Number of records in the database |
|
Sending records from the database into the process |
|
Sending records from the process for writing to the database using the data record index |
|
Send the SQL statement to the ODBC driver |
|
Empfang von Datensätzen aus dem Prozess in Datenbank mit Anforderung der akt. Treiber-Werte durch das VisuCompact |
|
Deleting files |
|
Deleting directories |
|
Delete User |
|
Export of data from a data recorder view |
|
Function to check whether a file exists or not |
|
Exponential function e ^ x |
|
Deletes an ImageView and refills it |
|
Deletes the pictures of a PictureArea and refills them |
|
Returns a string from an INI file |
|
Reads the default printer (transfer of the index) |
|
Reads the default printer (transfer of the name) |
|
Function for inquiring about the current operating language |
|
Reads the number of printers from the system |
|
Reads the name of a printer |
|
Returns a substring from a source string |
|
Reading the current value of a tag property |
|
Read out user group |
|
Read out user information |
|
Reading out the content of a variable |
|
Function to query whether an expression can be evaluated as a number |
|
Finding the length of a string |
|
10er logarithm |
|
10er logarithm |
|
Function for writing a string in the logbook |
|
Log-in user |
|
Log-out user |
|
Moving files, directories |
|
Add new picture or change picture |
|
Open a url |
|
Open an image |
|
Finding a string in a string |
|
Power function x ^ y |
|
Print an image |
|
Create a random number |
|
Initialization of the random generator |
|
Assigning a text file to a file variable |
|
Reads a line from a file and switches the file position pointer to the next line |
|
Function for reading the process variables used in the script |
|
Öffnen einer Text-Datei zu einer Dateivariablen |
|
Open a text file to a file variable |
|
Sets the default printer (transfer of the index) |
|
Sets the default printer (transfer of the name) |
|
Sets a string in an INI file |
|
Set a new language |
|
Setting the current value of a tag property |
|
Add / delete user to user group |
|
Set user information |
|
Set password |
|
Copy the content of a variable to another one |
|
Sine of an angle |
|
Hyperbolic sine of an angle |
|
Function to open the re-specifying dialogue |
|
Triggering special functions |
|
Square root |
|
Function for releasing the allocated memory |
|
Convert a number to a string |
|
Function to query whether the beginning of this string instance matches the specified string |
|
Function for formatting an integer / real that is formatted according to the instructions in a string format expression |
|
Function returns the zero-based index of the first occurrence of a specified Unicode character or Unicode string |
|
Function to insert a string at the specified index position |
|
Function for converting a string to lower case |
|
Function to remove a specified number of characters from the current string |
|
Function for replacing a Unicode character or a string in a character string |
|
Function to proof, if an expression is in a certain string |
|
Function to query whether the beginning of this string instance matches the specified string |
|
Function for inserting values into a character string |
|
Function for converting a string into an integer |
|
Function for converting a string into a number with decimal places |
|
Removes all named positions (left, right or both sides) where the letter to be removed occurs in a string |
|
Function for converting a string to upper case |
|
Tangent of an angle |
|
Hyperbolic tangent of an angle |
|
Read system date and time |
|
Function to convert milliseconds to seconds, hours, and minutes |
|
Conversion of time |
|
Convert UTC to local time |
|
Converting the local time into UTC time |
|
Convert a string to a number |
|
Checks whether the specified file path exists |
|
Starting a program |
|
Writing data to a text file to a file variable |
|
Function for writing the process variables used in the script |
Function groups¶
Fault processing functions¶
Fault processing functions |
|
---|---|
Setting, acknowledging and resetting alarms |
|
Function to open the re-specifying dialogue |
File processing / directory functions¶
File processing / directory functions |
|
---|---|
|
|
Assigning a text file to a file variable |
|
Assigning a text file to a file variable |
|
Copying files asynchronously in the background |
|
Closing a text file |
|
Copy a text file |
|
Function for comparing two files for size or time stamp |
|
Creation of directories |
|
Deleting files |
|
Deleting directories |
|
Function to check whether a file exists or not |
|
Returns a string from an INI file |
|
Moving files, directories |
|
Assigning a text file to a file variable |
|
Reads a line from a file and switches the file position pointer to the next line |
|
Öffnen einer Text-Datei zu einer Dateivariablen |
|
Open a text file to a file variable |
|
Sets a string in an INI file |
|
Checks whether the specified file path exists |
|
Writing data to a text file to a file variable |
Data management functions¶
Data management functions |
|
---|---|
Define type of the data field” |
|
Function for copying a data record from a database. |
|
Function for copying a data record from one database to another databaseusing the index data record. |
|
Function for deleting a data record from a database. |
|
Index of the data set in the database 0..max-1 data sets. |
|
The number of fields in a data record |
|
Name of a data record from the database” |
|
Function for searching for a data record with a certain name in a database. |
|
Receive data records from the process for writing to the database |
|
Receive data records from the process for writing to the database using the data record index |
|
Read a name of a data record from the database” |
|
Sending records from the database into the process |
|
Sending records from the process for writing to the database using the data record index |
|
Receipt of data records from the process into the database with request of the current values by the VisuCompact from the driver |
|
Sending records from the database into the process |
|
Function to inform all clients (grids) about a change in the transferred data management. |
Chart function¶
Chart-/data logger functions |
|
---|---|
Export of data from a data recorder view |
Functions for recipe management¶
Functions for recipe management |
|
---|---|
Change the status of a recipe |
|
Change the status of a recipe |
|
Change the version of a recipe |
|
Change the version of a recipe |
|
hange the name of a recipe |
|
hange the name of a recipe |
Functions for the ODBC interface¶
Functions of the ODBC interface |
|
---|---|
Establish a connection to the ODBC driver |
|
Connect to an ODBC data source |
|
Close the connection to the ODBC driver |
|
Send the SQL statement to the ODBC driver |
|
Execute an ODBC procedure |
|
Load data record from selected quantity |
|
Read data elements from ODBC buffer |
|
Change data elements from ODBC buffer |
|
Read time stamp from ODBC buffer |
|
Write time stamp from ODBC buffer |
|
Determine the number of selected data records and data elements |
|
Determine the structure of a data element in the selected table |
|
Get error texts for the last ODBC error |
String processing functions¶
String processing functions |
|
---|---|
Function to append a number to a string and another string that can be used as a separator for concatenation |
|
Change of date and time Time information in a string |
|
Returns a substring from a source string |
|
Function to query whether an expression can be evaluated as a number |
|
Finding the length of a string |
|
Finding a string in a string |
|
Convert a number to a string |
|
|
|
Function for formatting an integer / real that is formatted according to the instructions in a string format expression |
|
Function returns the zero-based index of the first occurrence of a specified Unicode character or Unicode string |
|
|
|
Function for converting a string to lower case |
|
Function to remove a specified number of characters from the current string |
|
Function for replacing a Unicode character or a string in a character string |
|
Function to proof, if an expression is in a certain string |
|
Function to query whether the beginning of this string instance matches the specified string |
|
Function for inserting values into a character string |
|
Function for converting a string into an integer |
|
Function for converting a string into a number with decimal places |
|
Removes all named positions (left, right or both sides) where the letter to be removed occurs in a string |
|
Function for converting a string to upper case |
|
Convert a string to a number |
Math functions¶
Trigonometric functions¶
Trigonometric functions |
|
---|---|
Cosine of an angle |
|
Sine of an angle |
|
Tangent of an angle |
|
Arccosine of an angle |
|
Arc sine of an angle |
|
Arc tangent of an angle |
|
Arctangent with two parameters of an angle |
|
Hyperbolic cosine of an angle |
|
Hyperbolic sine of an angle |
|
Hyperbolic tangent of an angle |
Time & date functions¶
Time & date functions |
|
---|---|
Conversion of seconds into date and time |
|
Conversion of date and time in seconds |
|
Read system date and time |
|
Convert UTC to local time |
|
Converting the local time into UTC time |
|
Function for adding specific time periods to the absolute system time |
|
Function for adding specific time periods to the absolute system time |
|
Function for converting dates and times to a string |
|
Function for converting a date in string format to an absolute value |
|
|
User management functions¶
User management functions |
|
---|---|
Log-in user |
|
Log-out user |
|
Create User |
|
Delete User |
|
Set password |
|
Read out user group |
|
Add / delete user to user group |
|
Read out user information |
|
Set user information |
Image processing functions¶
Image processing functions |
|
---|---|
Add a picture |
|
Function for changing the image |
|
Add new picture or change picture |
|
Open an image |
|
Cloase an image |
|
Print an image |
|
Function for changing all pictures |
|
Deletes an ImageView and refills it |
|
Deletes the pictures of a PictureArea and refills them |
Process variable functions¶
Process variable functions |
|
---|---|
Reading the current value of a tag property |
|
Function for reading the process variables used in the script |
|
Setting the current value of a tag property |
|
Function for writing the process variables used in the script |
|
Reading out the content of a variable |
|
Copy the content of a variable to another one |
Special functions¶
Special functions |
|
---|---|
Triggering special functions |
External function call / program start¶
External function call / program start |
|
---|---|
Starting a program |
Other functions¶
Other functions |
|
---|---|
Delays the script to be executed |
|
Function for writing a string in the logbook |
|
Set a new language |
|
Create a random number |
|
Initialization of the random generator |
|
Changes the current project |
|
Function for inquiring about the current operating language |
|
Open a url |
DIN 8743 functions¶
DIN 8743 functions |
|
---|---|
Function to start the evaluation |
|
Function to start the evaluation |
|
Function for releasing the allocated memory |
Printer handling functions¶
Printer handling functions |
|
---|---|
Reads the number of printers from the system |
|
Reads the name of a printer |
|
Reads the default printer (transfer of the index) |
|
Reads the default printer (transfer of the name) |
|
Sets the default printer (transfer of the index) |
|
Sets the default printer (transfer of the name) |
Fault processing functions (only SCADA)¶
Alert / AlertAsync¶
The “Alert” or “AlertAsync” function is used to set, quitt and reset faults. There is no longer any difference between the two functions. Scripts are always processed from starktionsdefinitiont to finish without interruption. A user is only sent when quitting or commenting an alert. With setting an alert, that is not possible.
Important
Before being called, the functions write the process variables of the script to the process, since dynamic text portions of alarms may have changed and reads back the process variables again after calling.
Important
In the client / server system, an immediate reset of a previously triggered alarm cannot be implemented due to the networked systems
Function definition: Alert(set_reset, number : integer) : integer
AlertAsync (set_reset, number : integer) : integer
Parameter: |
|
---|---|
set_reset |
Index for action |
0 = reset all faults |
|
1 = set specified fault |
|
2 = reset specified fault |
|
3 = acknowledge all faults |
|
4 = acknowledge specified fault |
|
Number |
Number of the fault to reset / set |
Return values: |
|
-1 |
If function was carried out successfully |
0 |
If function was carried out successfully |
with index for action 1, 2 or 4 the return value (executed for alarm action)is the same as the corresponding alarm instance ID
Important
With index “0” for the action, all existing project and system alarms are checked and reset, therefore time-consuming!
SpecAlert¶
Function to open the re-specification dialog. Optionally filtered by unit
Important
This command only works for registered clients, ie in a local script!This command will not work in a script that is executed when the system is started, since the web server is not yet accepting any client requests!
Function definition: SpecAlert(Unit: string) : integer
Parameter: |
|
---|---|
Unit |
Name of the unit to be filtered by |
Return values: |
|
0 |
if the dialogue was opened |
< 0 |
if the dialogue cannot be opened |
File processing / directory functions (only SCADA)¶
Append¶
Function to open an existing text file to append further data. Append opens the file that was previously linked to the text file variable by Assign and puts the current position within this file at the end. If the file does not exist, it will be created beforehand. The following write actions therefore append new data.
Function definition:
Append(File : Text) : integer
Parameter: |
|
---|---|
Name |
Name of the file to be opened |
Return values: |
|
0 |
if file cannot be opened |
< 0 |
if file cannot be opened |
Assign¶
Function for assigning a text file to a file variable.Assign assigns the file specified by name to the file variable “File”. All further operations with File refer to this file until File is assigned to another external file by calling Assign again.
Function definition: Assign(File : Text, Name : string) : integer
Parameter: |
|
---|---|
File |
File variable for further file access |
Name |
Name of the file to be opened |
Return values: |
|
0 |
if file cannot be opened |
<0 |
if file could not be allocate |
Note
Up to max. 20 assign commands can be made.
AssignUnsafe¶
The file access functions that begin with Assign are too slow. The reason for this is, that the file is closed after each ReadLine and opened again the next time. A file with many thousands of lines of text needs a long time to be read.AssignUnsafe keeps the file open until the file is explicitly closed with a Close command.
AssignUnsafe hält die Datei so lange geöffnet, bis die Datei explizit per Close-Befehl geschlossen wird.
Important
The calibration engineer must ensure that the file is closed. Simultaneous write access to a file is no longer possible, as is the case with Assign.
AssignUnsafe works in the same way as Assign.
Note
Increasing the “Const Lines” can lead to a significantly higher performance than using AssignUnsafe.
Function definition: AssignUnsafe(File : Text, Name : string) : integer
Parameter: |
|
---|---|
File |
File variable for further file access |
Name |
Name of the file to be opened |
Return values: |
|
0 |
if file cannot be opened |
<0 |
if file could not be allocate |
BackCopyFiles¶
Function to copy files in the background. At the time of the call, all specified files are recorded and copied step by step. If the file currently to be copied changes, it is copied again until a complete copy has been made without changes. If the file has not been copied after n attempts to copy it, it is skipped.
The copy function runs in parallel in the background and must be checked by means of status queries. The copy function can only be used once in the project at the same time. The use of wildcards is possible. The size of the sub-blocks to be transferred is determined via the menu item Configuration, [GLOBAL] CopyBufferSize.
Function definition: BackCopyFiles (Source, Destination : string, Command : integer) : integer
Parameter: |
|
---|---|
Source |
Source filenames with wildcards |
Destination |
Target file names with wildcards |
Command |
Command parameters |
0 = copy files |
|
1 = query copy status |
|
2 = query error code |
|
3 = cancel copy action |
|
Return values: |
|
The function value has two meanings depending on the command |
|
Command 0, 1, 3 |
|
0 |
last copy function ended correctly |
1 |
Copy function not active |
2 |
Copy function active |
-1 |
a bug in copy function |
Command 2 |
|
0 |
no errors in copy function, but in event code parameters |
<>0 |
defined error code |
Close¶
Function to close a text file.The file previously opened with Reset, Rewrite or Append is brought up to date, ie data that has not yet been written is written.
Function definition: Close(File : Text) : integer
Parameter: |
|
---|---|
File |
File variable for further file access |
Return values: |
|
0 |
if the file was closed |
<0 |
if the file was not closed |
Note
The connection between the file tag and the file assigned with Assign is not broken.
CopyFiles¶
Function for copying files
Function definition: CopyFiles(SourceName, DestName : string) : integer
Parameter: |
|
---|---|
SourceName |
Name of the source file (s) with wildcards “*“ and “?“ |
DestName |
Name of the destination file (s) with wildcards “*“ and “?“ |
Return values: |
|
>= 0 |
Number of files copie |
-1 |
General error |
Note
The source and target directories must exist. When copying large amounts of data, please note that no other actions can take place at this point.
CompareFiles¶
Function for comparing two files for size or time stamp
Function definition: CompareFiles(StrFile1, StrFile2 : string, Mode : integer, Delta : real) : integer
Parameter: |
|
---|---|
StrFile1 |
File name with complete path |
StrFile2 |
File name with complete path |
Mode |
Comparison mode |
file size comparison |
|
Time comparison of the creation time stamp |
|
Time comparison of the change time stamp |
|
3 = Time comparison of the last time stamp of access (only NTFS) |
|
Delta |
Delta window for time comparisons in msec |
Return values: |
|
-3 |
invalid mode specification |
-2 |
StrFile2 does not exist |
-1 |
StrFile1 does not exist |
0 |
both the same |
1 |
StrFile1 smaller or older StrFile2 |
2 |
StrFile1 larger or younger StrFile2 |
CreateDir¶
Function for creating directories.
Function definition: CreateDir(Name : string) : integer
Parameter: |
|
---|---|
Name |
Name of the directory to be created |
Return values: |
|
0 |
If function was carried out successfully |
< 0 |
If function was carried out successfully |
Important
If only one directory is to be created or a directory is to be appended to an existing path, then the command must only be executed once. If, on the other hand, you want to create a more detailed path, the command must be executed several times in a row (see example).
DeleteFiles¶
Function to delete files.
Function definition: DeleteFiles(Name : string) : integer
Parameter: |
|
---|---|
Name |
Name of the file (s) to be deleted with wildcards ”*” and ”?” |
Return values: |
|
> 0 |
Number of files deleted |
< 0 |
when deletion has errors |
-1 |
if no file found to delete |
-2 |
if file no longer found when deleting |
-3 |
if path does not match (source or target) |
-4 |
if file cannot be opened |
-5 |
if no access rights| |
further errors not documented |
DeleteTree¶
Function for deleting directories and their content as well as all subdirectories and their content.
Function definition: DeleteTree(Name : string) : integer
Parameter: |
|
---|---|
Name |
Name of the directory tree to be deleted |
Return values: |
|
0 |
If function was carried out successfully |
< 0 |
If function was carried out successfully |
ExistFile¶
Function to check whether a file exists or not
Function definition: ExistFile(StrName : string) : integer
Parameter: |
|
---|---|
StrName |
File name with complete path |
Return values: |
|
-3 |
Drive or UNC-Name not found |
-2 |
path not found |
-1 |
File does not exist |
0 |
file available |
GetIniString¶
Function for reading a string from an INI file.
Function definition: GetIniString(Filename, Section, Key, Default, ReturnString : string) : integer
Parameter: |
|
---|---|
Filename |
File name of the ini file with file extension and directory.If no directory is specified, the file is searched for in the project directory. (Directory with file name max. 256 characters |
Section |
Section in the file (1 to max. 256 characters); Specification of the section without brackets |
Key |
Key in the file (1 to max. 256 characters) |
Default |
ReturnString is set to the default if ReturnString cannot be determined. |
ReturnString |
ad string |
Return values: |
|
0 |
Function carried out without errors |
-1 |
Directory or file not found |
-6 |
Section not set |
-7 |
Key not set |
MoveFiles¶
Function for moving files and directorie.
Function definition: MoveFiles(SourceName, DestName : string) : intege
Parameter: |
|
---|---|
SourceName |
Name of the source file (s) with wildcards “*“ and “?“ |
DestName |
Name of the destination file (s) with wildcards “*“ and “?“ |
Return values: |
|
> = 0 |
Number of moved files, directories |
-1 |
General error |
Important
You cannot move directories from one drive to another. This is not supported by the Windows API!The contents of the directories can, however, be moved!
Note
The source and target directories must exist. When moving large amounts of data, make sure that no other actions can take place at this moment.
Read¶
Function for reading data from a text file. The “Assign” function is used to assign a text file to a file variable. After opening the file with the “Reset” function, the content of the file can be read line by line, i.e., each “Read” command reads one line and then switches the position indicator to the next line. If you want to read from the beginning of the text file again, it must be closed and reopened. The content of a line is precisely determined by the field width and the decimal places.
Function definition: Read(File : Text, v1 [,v2,….,vn]) : integer
Parameter: |
|
---|---|
File |
File tag for file access |
v1..vn |
Tags of the data to be read, max. 10 pieces |
Example: Value11 := 10 |
|
Read(File, Wert11 : 6 : 3) somit gilt allgemein |
|
v1 = tag [: field width [: decimal place]] |
|
Return values: |
|
0 |
if all of the file was read |
<0 |
if nothing of the file was read |
ReadLine¶
Reads a line from a file and switches the file position pointer to the next line.
Function definition: ReadLine(File : Text, ReturnString : string) : integer
Important
The file tag File must first be assigned the file name of a file using the Assign command (see example)!
Parameter: |
|
---|---|
File |
File tag for file access |
ReturnString |
Ermittelte Zeile |
Return values: |
|
0 |
Function carried out without errors |
1 |
End of file reached |
-5 |
Reading not possible |
Note
No check whether ReturnString is too short! Please ensure that the ReturnString is sufficiently large.
Reset¶
Function to open a text file for a file variable. The file is only opened for reading and is positioned at the beginning of the file when it is opened.
Function definition: Reset(File : Text) : integer
Parameter: |
|
---|---|
File |
File variable for further file access |
Return values: |
|
0 |
if file cannot be opened |
<0 |
if file cannot be opened |
Rewrite¶
Function for opening or creating a text file for a file variable. If the specified file exists, it is completely deleted and recreated. Rewrite creates a file with the name selected in Assign.
Function definition: Rewrite(File : Text) : integer
Parameter: |
|
---|---|
File |
File variable for further file access |
Return values: |
|
0 |
if file cannot be opened |
< 0 |
if file cannot be opened |
SetIniString¶
Function for writing a string to an INI file
Funktionsdefinition: SetIniString(Filename, Section, Key, StringWert : string) : integer
Parameter: |
|
---|---|
Filename |
File name of the ini file with file extension and directory.If no directory is specified, the file is searched for in the project directory. If the file does not exist, a new one is created (directory with file name max. 256 characters |
Section |
Section in the file. If the section does not exist, it is created automatically (1 to max. 256 characters) |
Key |
Key in the file. If the key is not available, it will be created automatically (1 to max. 256 characters) |
StringWert |
String that is to be set |
Return values: |
|
0 |
Function carried out without errors |
-1 |
Directory not found |
-2 |
Drive not found |
-3 |
String cannot be determined |
-4 |
Section not correct |
-5 |
Key not correct |
ValidPath¶
Function to check whether a file path is valid or not.
Function definition: ValidPath(StrName : string) : integer
Parameter: |
|
---|---|
StrName |
Path specification |
Return values: |
|
0 |
if path is valid |
< 0 |
if path is not valid |
Write¶
Function for writing data in a text file to a file tag.
Function definition: Write(File : Text, v1 [,v2,….,vn]) : integer
Parameter: |
|
---|---|
File |
File variable for further file access |
v1..vn |
Tags of the data to be written with format specification max. 10 pieces |
Example: Value11 := 10 |
|
Write(File, Wert11 : 6 : 3) results in writing ” 10.000” to the file |
|
thus generally v1 = expression [: field width [: decimal places]] |
|
Return values: |
|
0 |
when everything has been written to the file |
<0 |
when nothing could be written to the file |
Datamanagement functions¶
Many of the functions described in the following section are also available asf special functions (see further below in this chapter) and on function keys (see data management in the Data chapter)
DBAccessValue¶
This function is used to have read or write access to individual fields of a data record. This means that individual components of a data record can be processed in a targeted manner without affecting the entire data record.
Two indices are specified for the selection of the data field. Record addresses the index of the data record in the database and Index addresses the number of the field within the data record. If you think of such a database as a table, record corresponds to the row and index to the column of the table.
To be able to use this function sensibly, the type of the affected field must be determined with the function DBFieldType. Depending on the field type, a corresponding buffer must be specified when calling, in which the data can be stored when reading or fetched when writing. With this function, fields of the type CURVEx can neither be read nor written.
With this function it should also be noted that the six standard fields are excluded from write access (see DBFieldType and DBFieldCount).
Function definition: DBAccessValue(DataMgmt: string, Record, Index, Access:integer, Buffer : undef) : integer
Parameter: |
|
---|---|
DataMgmt |
Name of the database or data management |
Record |
Number of the data record (note the standard columns!) |
Index |
Position of the field in the data record |
Index = 0 |
database column: ‘ID’ |
Index = 1 |
database column: ‘Name’ |
Index = 2 |
database column: ‘CreatedOn’ |
Index = 3 |
atabase column: ‘CreatedBy’” |
Index = 4 |
database column: ‘CreatedOn’ |
Index = 5 |
database column: ‘ChangedBy’ |
Index = 6 |
database column: ‘Checksum’ |
Index = 7 |
database column: ‘First tag column’ |
Access |
Access type (1 = write, 2 = read) |
Buffer |
Buffer for the value of the field to be read or written; this buffer must correspond to the field type (real variable for logical and numerical process variables, string for string variable; see also command: DBFieldTyp) |
Return values: |
|
>= 0 |
Field element determined |
-1 |
General parameterisation error |
-3 |
Database is defective |
-4 |
insufficient main memory |
-5 |
Record or index unknown |
Important
Standard columns are variable in data management depending on the header selection. With “Standard” there are 7 default columns (6 with ODBC), with order 21, with “Recipe” there are 17 and with “No header (user-defined)” there are none that must be added.
DBCopy¶
Function for copying data records from a database into a new database with the same structure and name in another directory or drive.If the database is available in the target directory, the data record is placed in front of the existing one or the existing data record is replaced.
Function definition: DBCopy(DataMgmt, DataRecord, Path: string, Flag: boolean) : integer
Parameter: |
|
---|---|
DataMgmt |
Name of the database or data management |
DataRecord |
Name of the dataset |
Path |
Path for export or import (database name not required here) |
Flag |
flag for export or import of the data set |
Export = 1 and Import = 0 |
|
Return values: |
|
0 |
if the function was carried out successfully |
<> 0 |
if an error occurred in function |
DBCopyIndex¶
Function for copying a data record from a database into the same database in another directory or drive.The data record is specified via its position in the database.
Function definition: DBCopyIndex(DataMgmt, Path : string, Index : integer, Append, Flag : Boolean) : integer
Parameter: |
|
---|---|
DataMgmt |
Name of the database or data management |
Path |
Path of the database into which the data record is to be copied. |
Index |
Index of the data record in the source database 0..max-1 data records. |
Append |
Flag for data record append in target database |
1 = Append (the index position is not taken into account, but appended to the next index) |
|
0 = note index position (index will be overwritten; it must exist in the target database!) |
|
ExportImport |
Flag for export or import of the data set |
Export == 1 and Import == 0 |
|
Return values: |
|
0 |
if the function was carried out successfully |
<> 0 |
if an error occurred in function |
-1 |
general parameterisation error |
DBDelete¶
Function for deleting a data record from a database.
Function definition: DBDelete(DataMgmt, DataRecord: string) : integer
Parameter: |
|
---|---|
DataMgmt |
Name of the database or data management |
DataRecord |
Name of the dataset |
Return values: |
|
0 |
if the function was carried out successfully |
<> 0 |
if an error occurred in function |
-1 |
general parameterisation error |
DBDeleteIndex¶
Function for deleting a data record from a database. The data record is specified via its position in the database. (The first record in the database has the number zero)
Function definition: DBDeleteIndex(DataMgmt: string, Index : integer) : integer
Parameter: |
|
---|---|
DataMgmt |
Name of the database or data management |
Index |
Index of the data set in the database 0..max-1 data sets. |
Return values: |
|
0 |
if the function was carried out successfully |
<> 0 |
if an error occurred in function |
-1 |
general parameterisation error |
Function value + 100 |
System alarm number |
DBFieldCount¶
This function returns the number of fields in the data record of a database. The number also includes the six fields that are automatically assigned to each data record (name of the data record, creation date, creation time, change date, change time, user name of the change).
For example, if a data type only consisted of an element defined by the user, the function value in this case would be 7.
Function definition: DBFieldCount (Type: string) : integer
Parameter: |
|
---|---|
DataMgmt |
Name of the database or data management |
Return values: |
|
> 0 |
The number of fields in a data record |
-1 |
general parameterisation error |
-2 |
Data record not in the database |
-3 |
Database is defective |
-4 |
not enough main memory to run |
DBFieldType¶
This function can be used to determine the types of the individual fields to be able to access the values of the fields.This function also considers the six fields that are automatically assigned to each data record (name of the data record, creation date, creation time, change date, change time, username of the change).
The first six fields of each data type are therefore permanently assigned:
Fieldname |
Meaning |
Type |
---|---|---|
NAME |
Name of the dataset |
with max. 31 characters ended with 0 |
CDATE |
Creation date |
Date string in the format DD.MM.YYYY |
CTIME |
Creation time |
Time string in the format DD.MM.YYYY |
UPDATE |
last modification date |
Date string in the format DD.MM.YYYY |
UPTIME |
last modification time |
Time string in the format DD.MM.YYYY |
USER |
Username of the last change |
String with max. 31 characters |
If the DBFieldType function can be executed successfully, it returns the name in the parameter name and the type of the specified field in Ftype.The fields created by the user can have the types listed in the following table (x in field names stands for a column index).
Fieldname |
Meaning |
---|---|
BOOLx |
logical process tag |
REALx |
numeric process tag |
STRx |
tring variables |
CURVEx |
Transiente variables |
Function definition: DBFieldType(DataMgmt: string, Index:integer, Name: string, Ftype:integer) : integer
Parameter: |
|
---|---|
DataMgmt |
Name of the database or data management |
Index |
Position of the field in the data record |
Name |
Buffer for field name |
Ftype |
Typkennung des Feldes mit |
$0001 = Datensatzname |
|
$0002 = Creation date |
|
$0003 = Creation time |
|
$0004 = last modification date |
|
$0005 = last modification time |
|
$0006 = User name |
|
$0007 = Text variable |
|
$0008 = Transient variable |
|
$0101 = logical process tag |
|
$1001 = logical process tag |
|
Return values: |
|
>= 0 |
Field element determined |
-1 |
general parameterisation error |
-3 |
Database is defective |
-4 |
not enough main memory to run |
-5 |
Index does not exist |
DBFindRecord¶
This function searches the specified database for the data record with the desired name.If the data record is found in the database, the return value supplies the ID (index) of the data record.
Function definition: DBFindRecord(DataMgmt, DataRecord: string) : integer
Parameter: |
|
---|---|
DataMgmt |
Name of the database or data management |
DataRecord |
Name of the dataset |
Return values: |
|
>= 0 |
if the function was executed successfully, the function value corresponds to the position of the data record |
< 0 |
if an error has occurred in function |
-1 |
General parameterisation error, no data record found |
-3 |
Database is defective |
-4 |
not enough main memory to run |
DBReceive / DBSyncReceive / DBReceiveIndex¶
Process variables that have been specified in the data management are written as data records to the database (hard disk) by the DataServer. The script server sends the variables modified in the script to the data server for processing. This reads the variables from the process and writes the values to the database. For processing, the script then continues via the script server.
The functions DBReceive and DBSyncReceive work identically. Also, the function DBReceiveIndex, but here instead of the name, the index of the data record is used.
Function definition: DBReceive(DataMgmt, DataRecord: string) : integer
Parameter: |
|
---|---|
DataMgmt |
Name of the database or data management |
DataRecord |
Name of the datarecord |
Return values: |
|
0 |
if the function was carried out successfully |
<> 0 |
if an error occurred in function |
-1 |
if parameterisation error |
DBRecordName¶
This function reads the name of the data record in the specified database that is in the position parameterised with “Record”.If the data record is available, the data record name is returned in StrName. In this case, the function value corresponds to the data record number, otherwise it is less than zero. If the value -1 is specified as the data record number, this function returns the number of data records in the database as a function value and no data record name in StrName
Function definition: DBRecordName (DataMgmt: string, Record : integer, DataRecord : string) : integer
Parameter: |
|
---|---|
DataMgmt |
Name of the database or data management |
Record |
Number of the data record (if this value is -1 it indicates the number of data records) |
DataRecord |
Name of the dataset |
Return values: |
|
>= 0 |
if the function was executed successfully, the function value corresponds to the position of the data record |
< 0 |
if an error occurred in function |
-1 |
general parameterisation error |
-3 |
Database is defective |
-4 |
not enough main memory to run |
-5 |
Record not known |
DBSend / DBSyncSend / DBSendIndex¶
Function for sending data records, which were previously defined in the data management, from the database to the process.
Process variables that have been specified in the data management are written as data records to the database (hard disk) by the DataServer. The script server sends the variables modified in the script to the data server for processing. This reads the variables from the process and writes the values to the database. For processing, the script then continues via the script server, which reads in the modified variables again before continuing to work.
The functions DBSend and DBSyncSend work identically. Also the function DBSendIndex, but instead of the name, the index of the data record is used.
Function definition: DBSend(DataMgmt, DataRecord:string) : integer
Parameter: |
|
---|---|
DataMgmt |
Name of the database or data management |
DataRecord |
Name of the datarecord |
Return values: |
|
0 |
if the function was carried out successfully |
<> 0 |
if an error occurred in function |
-1 |
General parameterisation error |
DBNotifyDataChanged¶
Function to inform all clients (grids) about a change in the transferred data management.
Function definition: DBNotifyDataChanged(StrType : string) : integer
Parameter: |
|
---|---|
StrType |
Name of the data type |
Return values: |
|
0 |
if the function was carried out successfully |
After calling up, all data grids that are currently displaying data from the specified data management system are updated by reloading the focused data. However, the selection and scroll position are retained. Return value 0 if executed without errors. Less than 0 if an error occurred during execution. If there is no data management with the specified name, nothing is updated and 0 is returned.
Important
The new data grid is updated automatically if data records are manipulated, added or deleted via data management functions (e.g. DBReceive). If data management is manipulated from outside or via ODBC, the grid does not notice this.
Chart-/datalogger funtions (only SCADA)¶
DVExportView¶
This function is used to export the data of a data recorder view related to batch or date.The export takes place on the machine on which the DataServer is running, either to a directory specified by the project or by call parameters.
Funvtion definition: DVExportView(ViewName : string, ChargeName : string, StartTime : real, EndTime : real, FilePath : string)
Parameter: |
|
---|---|
ViewName |
Name of the data recorder view |
ChargeName |
Name of the batch |
StartTime |
Optional: start time in seconds since 01/01/1970;With -1 the start time is not evaluated |
EndTime |
Optional: end time in seconds since 01/01/1970;With -1 the eend time is not evaluated |
FilePath |
Name of the file or path in which the export is to be saved |
Return values: |
|
>=0 |
Amoutn of exported data sets if the function was carried out successfully |
-1 |
general parameterisation error |
-2 |
Invalid data recorder view name |
-3 |
Data recorder for batch not found |
-4 |
No batch or data found |
-5 |
Start time invalid |
-6 |
End time invalid |
Important
Depending on the number of data records, the export can take a certain amount of time!
Functions recipe management¶
With the new recipe management in the PROCON-WEB DataServer, new functions for recipe management have also been added to the PROCON-WEB scripting.
When using the recipe management functions, the state model of the recipe management must be observed, which is briefly outlined here:

Important
Version and name can only be changed in the “Draft” status of a recipe.
DBRecipeChangeState¶
This function can be used to change the status of a recipe. Depending on the current status of the recipe, only certain subsequent statuses can be set.
Possible recipe status:
Draft = 1,
Released = 2,
Deleted = 4,
Locked = 8,
InUse = 16
Function definition: DBRecipeChangeState(StrType, StrName : string, State : integer) : integer
Parameter: |
|
---|---|
StrType |
Name of the recipe data type |
StrName |
Name of a data record from the database” |
State |
New status of a recipe |
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
Type not found |
-2 |
Type is not a recipe type |
-3 |
Status change not allowed (wrong state) |
-4 |
unknown state |
-5 |
Datarecord not found |
DBRecipeChangeStateIndex¶
This function can be used to change the status of a recipe. Depending on the current status of the recipe, only certain subsequent statuses can be set.
Possible recipe status:
Draft = 1,
Released = 2,
Deleted = 4,
Locked = 8,
InUse = 16
Function definition: DBRecipeChangeStateIndex(StrType : string, Index : integer, State : integer) : integer
Parameter: |
|
---|---|
StrType |
Name of the recipe data type |
Index |
Index of the data set in the database |
State |
New status of a recipe |
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
Type not found |
-2 |
Type is not a recipe type |
-3 |
Status change not allowed (wrong state) |
-4 |
unknown state |
-5 |
Datarecord not found |
DBRecipeChangeVersion¶
Functions for changing the recipe version. The recipe version can only be increased by the specified delta.The parameter versionpart indicates which part of the version is increased.
Possible version elements (structure of the version number is: Major.Minor.Build):
Build = 0
Minor = 1
Major = 2
Function definition: DBRecipeChangeVersion(StrType, StrName : string, Versionpart, Delta : integer) : integer
Parameter: |
|
---|---|
StrType |
Name of the recipe data type |
StrName |
Name of a data record from the database” |
Versionpart |
Part of the version number, that should be increased |
Delta |
“Value by which the version number is incremented |
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
Type not found |
-2 |
Type is not a recipe type |
-3 |
Version already exists |
-4 |
Version already exists |
-5 |
Datarecord not found |
DBRecipeChangeVersionIndex¶
Functions for changing the recipe version. The recipe version can only be increased by the specified delta.The parameter versionpart indicates which part of the version is increased.
Possible version elements (structure of the version number is: Major.Minor.Build):
Build = 0
Minor = 1
Major = 2
Function definition: DBRecipeChangeVersionIndex(StrType : string, Index, versionpart, delta : integer): integer
Parameter: |
|
---|---|
StrType |
Name of the recipe data type |
Index |
Index of the data set in the database |
Versionpart |
Part of the version number, that should be increased |
Delta |
“Value by which the version number is incremented |
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
Type not found |
-2 |
Type is not a recipe type |
-3 |
Version already exists |
-4 |
Version already exists |
-5 |
Datarecord not found |
DBRecipeChangeName¶
Functions for changing the recipe name.
Function definition: DBRecipeChangeName(StrType, StrName, Name : string) : integer
Parameter: |
|
---|---|
StrType |
Name of the recipe data type |
StrName |
Name of a data record from the database” |
Name |
New name of a recipe |
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
Type not found |
-2 |
Type is not a recipe type |
-5 |
Datarecord not found |
DBRecipeChangeNameIndex¶
Functions for changing the recipe name.
Function definition: DBRecipeChangeNameIndex(StrType : string, Index : integer, Name : string) : integer
Parameter: |
|
---|---|
StrType |
Name of the recipe data type |
Index |
Index of the data set in the database |
Name |
New name of a recipe |
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
Type not found |
-2 |
Type is not a recipe type |
-5 |
Datarecord not found |
functions of the ODBC interface¶
The Open Database Connectivity interface extends the scope of the PROCON-WEB formulas to include the possibility of accessing internal and external databases. It is not the format of the database, or the file formats used in the database that is decisive, but the availability of an ODBC driver.
To be able to use this interface in the formulas, ODBC itself must first be installed in the operating system (system control). If an external database is to be addressed, this must also be correctly installed. During the ODBC installation, the drivers that are to be used in the PROCON-WEB formulas must be set up. To use the internal databases, for example, a dBase driver must be defined. Setting up an ODBC driver includes assigning the target database and assigning access names and passwords.
The performance and the range of functions of the ODBC interface depend on the ODBC driver used. When using the formulas for the ODBC interface, the scope of performance of the driver used must therefore be checked against the corresponding documentation.
However, the functional principle of the ODBC interface is generally based on the same mechanisms. First, the connection to the ODBC driver must be established (DBOpenODBC function). The name that was assigned during the driver installation is used for this. If this was carried out successfully, a so-called handle is supplied for this connection, via which all further actions are addressed. A maximum of twenty such connections can be used at the same time.
On an open connection, a selection (“Select statement”) is then carried out on the database using an SQL statement (DBSendSQLODBC). This instruction is used to select a subset (“table”) from the database or the entire database from the database connection established via the driver. A string is used for the selection, in which the type of selection is described with a given SQL grammar.
In addition to the selection with the SQL command SELECT, data records can also be inserted or deleted directly in the database with the SQL commands INSERT and DELETE.
The different ODBC drivers allow the SQL grammar to be used in different expansion stages. However, they at least support the minimal grammar.
The table generated by the selection is then the starting point for further operations. Information, read and write functions can be carried out on it (DBFetchTabODBC, DBGetDataODBC, DBPutDataODBC, DBGetErrorODBC, DBGetInfoTabODBC, DBGetInfoDataODBC). Depending on the type of ODBC driver, there is also the option of executing ODBC procedures (DBProcedureODBC). ODBC procedures can contain complete SQL sequences and simplify standardised or stereotypical actions on databases considerably.
If the connection to the ODBC driver is no longer required, it must be closed again (DBCloseODBC). For security reasons, the ODBC interface has been implemented in the formulas in such a way that the connection to the ODBC driver and thus to the database is automatically closed when the executed event code is terminated. This affects, for example, ODBC activities in a picture event code.
DBOpenODBC¶
This function establishes the connection to the ODBC driver. It must be executed as the first function, because if the execution is successful, the handle is returned as a database key, which can then be used as a parameter when the other ODBC functions are called.
With this function, the required ODBC driver is parameterised using its name. If user names and passwords were assigned when this driver was set up, these must also be entered when opening the connection. A maximum of 20 ODBC connections can be open at the same time.
Function definition: DBOpenODBC (ODBCDriver, User, Password : string) : integer
Parameter: |
|
---|---|
ODBCDriver |
Name of the ODBC-driver (max. 255 characters) |
User |
Name of the user (max. 255 characters) |
Password |
Password of the user (max. 255 characters) |
Return values: |
|
0..19 |
Key on database for further database access |
-1 |
no more free handle |
-2 |
Lack of memory |
-3 |
Error from ODBC driver |
DBOpenODBCConnection¶
This function is used to establish the connection to an ODBC data source. The ODBC data source must be defined beforehand in the designer.
This must be carried out as the first function, because if the execution is successful, the handle is returned as a database key, which can then be used as a parameter when the other ODBC functions are called.
With this function, the required ODBC data source is parameterized via its name. A maximum of 20 ODBC connections can be open at the same time.
Function definition: DBOpenODBCConnection (ConnectionName : string) : integer
Parameter: |
|
---|---|
ConnectionName |
Name of the ODBC data source defined in the designer (max. 255 characters) |
Return values: |
|
0..19 |
Key on database for further database access |
-1 |
no more free handle |
-2 |
Lack of memory |
-3 |
Error from ODBC driver |
-4 |
ODBC data source not found |
DBCloseODBC¶
The connection to the specified ODBC driver is closed.
This function should always be carried out when a connection is no longer required. This frees up occupied resources. If this function is not called the Runtime closes the connections when the affected event code is exited automatically.
The connection is parameterised via the connection handle.
Function definition: DBCloseODBC (ODBCHandle : integer) : integer
Parameter: |
|
---|---|
ODBCHandle |
Connection handle to the ODBC driver (0. 19) |
Return values: |
|
0 |
Function carried out successfully |
-1 |
Incorrect database access key |
DBSendSQLODBC¶
This function executes an SQL statement on an open connection.
SQL SELECT statement: It must be called before the actual access functions to the database table can be used. All other ODBC functions are then carried out on the data selected using this instruction.
SQL INSERT and SQL DELETE statement: These instructions insert or delete records in the database.
The connection to the ODBC driver must be open. The specified SQL string must comply with the SQL grammar of the connected ODBC driver.
Function definition: DBSendSQLODBC (ODBCHandle : integer, SQL : string) : integer
Parameter: |
|
---|---|
ODBCHandle |
Connection handle to the ODBC driver (0. 19) |
SQL |
“SQL-instruction with max. 400 characters |
Return values: |
|
0 |
Function carried out successfully |
-1 |
Incorrect database access key |
-3 |
Error from ODBC driver |
DBProcedureODBC¶
This function is used to execute an ODBC procedure. The prerequisite for this is that, on the one hand, the connection to the driver has been established and, on the other hand, the ODBC driver concerned supports this option at all.
The procedure must also be created in the database under the specified name. For more information on this topic, see the documentation for the ODBC database server.
Function definition: DBProcedureODBC (ODBCHandle : integer, Proc : string) : integer
Parameter: |
|
---|---|
ODBCHandle |
Connection handle to the ODBC driver (0. 19) |
Proc |
Name of the procedure to be performed (max. 255 characters) |
Return values: |
|
0 |
Function carried out successfully |
-1 |
Incorrect database access key |
-3 |
Error from ODBC driver |
-6 |
the database cannot execute any procedures |
DBFetchTabODBC¶
This function loads a data record from the selected quantity into an internal buffer. There it is then available for further processing. The data record is selected via the “Pos” parameter. Positioning is always relative to the previous actions or directly to the beginning or end of the selected data records.
With the table-oriented model of the selected data set, this function prepares a row of the table for processing.The connection to the ODBC driver must be open.
Function definition: DBFetchTabODBC (ODBCHandle, Pos : integer) : integer
Parameter: |
|
---|---|
ODBCHandle |
Connection handle to the ODBC driver (0 … 19) |
Pos |
Position of the data record in the selected set; only the following information is allowed: |
0 = next record in the table |
|
1 = previous data record |
|
2 = first data record |
|
3 = last record |
|
While 0 is allowed for all ODBC drivers, the other values only apply to some. |
|
Return values: |
|
0 |
Function carried out successfully |
-1 |
Incorrect database access key |
-3 |
Error from ODBC driver |
-4 |
no more data available |
DBGetDataODBC¶
If a data record is loaded into the internal processing buffer with the DBFetchTabODBC function, the data elements of this data record can be read with this function. The element (column) within the data record is selected with Pos.
The value of the selected column is made available in the specified buffer. The buffer must correspond to the type of the entry. Therefore, the type must first be determined with the DBGetInfoDataODBC function. The DBGetDataODBC function can be used on elements of the type string, logical or numeric.The connection to the ODBC driver must be open.
Function definition: DBGetDataODBC (ODBCHandle, Pos : integer, Buffer : undef) : integer
Parameter: |
|
---|---|
ODBC-Handle |
Connection handle to the ODBC driver (0. 19) |
Pos |
Number of the desired element (column number) |
Buffer |
Buffer for the transfer of the element content; it must match the type of the element(see DBGetInfoDataODBC) |
Return values: |
|
0 |
Function carried out successfully |
-1 |
Incorrect database access key |
-3 |
Error from ODBC driver |
-4 |
no more data available |
-5 |
wrong data types |
DBPutDataODBC¶
With this function elements of a data record can be changed. The data record to be processed must first be loaded into the internal buffer using the DBFetchTabODBC function. The element of the data record, i.e. the column, is addressed with the parameter Pos.
The value for the selected column must be provided in the specified buffer. The buffer must correspond to the type of the entry. Therefore, the type must first be determined with the DBGetInfoDataODBC function. The DBPutDataODBC function can be used on elements of the type string, logical or numeric.
Important
The DBPutDataODBC command does not work for databases in Excel format
The connection to the ODBC driver must be open.
Function definition: DBPutDataODBC (ODBCHandle, Pos : integer, Buffer : undef) : integer
Parameter: |
|
---|---|
ODBC-Handle |
Connection handle to the ODBC driver (0. 19) |
Pos |
Number of the desired element (column number) |
Buffer |
Buffer for transferring the element content; it must match the type of the element (see DBGetInfoDataODBC) |
Return values: |
|
0 |
Function carried out successfully |
-1 |
Incorrect database access key |
-3 |
Error from ODBC driver |
-4 |
no more data available |
-5 |
wrong data types |
DBGetStampODBC¶
If a data record is loaded into the internal processing buffer with the DBFetchTabODBC function, this function can be used to read a data element of this data record which is of the “date stamp” type. The element (column) within the data record is selected with Pos.
Since the “date stamp” type consists of six individual values, six tag specifications are required for the transfer of the values. The DBGetInfoDataODBC function can be used to determine whether a data element is of this type.The connection to the ODBC driver must be open.
The connection to the ODBC driver must be open.
Function definition: DBGetStampODBC (ODBCHandle, Pos, Hour, Min, Sec, Day, Month, Year : integer) : integer
Parameter: |
|
---|---|
ODBC-Handle |
Connection handle to the ODBC driver (0. 19) |
Pos |
Number of the desired element (column number) |
Hour |
Buffer for hourly value |
Min |
Buffer for minute value |
Sec |
Buffer for second value |
Day |
Buffer for dayly value |
Month |
Buffer for monthly value |
Year |
Buffer for yearly value |
Return values: |
|
0 |
Function carried out successfully |
-1 |
Incorrect database access key |
-3 |
Error from ODBC driver |
-4 |
no more data available |
DBPutStampODBC¶
This function can be used to overwrite a date entry in a data record element. To do this, the data record must be loaded into the internal processing buffer with the DBFetchTabODBC function. The element (column) within the data record is selected with Pos.
Since the “date stamp” type has six individual values, six parameters are required for the transfer of the values. The DBGetInfoDataODBC function can be used to determine whether a data element is of this type.The connection to the ODBC driver must be open.
Function definition: DBPutStampODBC (ODBCHandle, Pos, Hour, Min, Sec, Day, Month, Year : integer) : integer
Parameter: |
|
---|---|
ODBCHandle |
Connection handle to the ODBC driver (0 … 19) |
Pos |
Number of the desired element (column number) |
Hour |
Hourly value |
Min |
Minute value |
Sec |
Second value |
Day |
Dayly value |
Month |
Monthly value |
Year |
Yearly value |
Return values: |
|
0 |
Function carried out successfully |
-1 |
Incorrect database access key |
-3 |
Error from ODBC driver |
-4 |
no more data available |
-5 |
wrong data types |
DBGetInfoTabODBC¶
With this function you can get information about the number of rows and columns, i.e. the number of data records and data elements. This function is applied to the table selected with the DBSendSQLODBC function.The connection to the ODBC driver must have been opened and the selection made.
Note
After this function has been executed, the fetch position of the DBFetchTabODBC () function is back at the beginning of the table
Function definition: DBGetInfoTabODBC (ODBCHandle, Rec, Col : integer) : integer
Parameter: |
|
---|---|
ODBC-Handle |
Connection handle to the ODBC driver (0 … 19) |
Rec |
Buffer for transferring the number of lines (data sets or records) |
Col |
Buffer for taking over the number of columns (number of data elements in a data set or record) |
Return values: |
|
0 |
Function carried out successfully |
-1 |
Incorrect database access key |
-3 |
Error from ODBC driver |
DBGetInfoDataODBC¶
This function provides information about the type and length of a column in the selected table. The structure of a data record element is described here. The information obtained in this way is necessary to be able to ultimately read or write access to the individual elements of the data records, since type-conform parameters must be specified for the access functions.
The connection to the ODBC driver must have been opened and the selection made.
Function definition: DBGetInfoDataODBC (ODBCHandle, Pos: integer, name: string, len: integer): integer
Parameter: |
|
---|---|
ODBC-Handle |
Connection handle to the ODBC driver (0 … 19) |
Pos |
Column index of the desired data element (starts with 1) |
Column name |
Name of the database column |
Type |
Buffer for adopting the column type |
1 = |
1 = Varbinary (checksum of PROCON-WEB standard columns) |
2 = |
Boolean element |
3 = |
Numeric element |
4 = |
date stamp |
5 = |
String |
Len |
Buffer for taking over the column width |
Return values: |
|
0 |
Function carried out successfully |
-1 |
Incorrect database access key |
-3 |
Error from ODBC driver |
DBGetErrorODBC¶
If one of the ODBC functions has reported the value -3 as a function value, i.e. an error from the ODBC driver, the associated error text can be fetched from the ODBC driver with this function. A buffer for a message and a status text must be specified. The texts can be up to 255 characters long, ie the buffers must be created to the appropriate size.
Function definition: DBGetErrorODBC (Message, State:string) : integer
Parameter: |
|
---|---|
Message |
Buffer for message text (255 characters) |
State |
Buffer for state text (255 characters) |
Return values: |
|
0 |
Function carried out successfully |
-1 |
String buffer not available |
String handling functions¶
Handling of text tags (strings) in the event code.
PROCON-WEB differentiates between two types of text tags, the event-local (variable type: string) and the global text tags from the image assembly.
Local text tags have a limited range of validity, for example only in the macro file, in the global event or in the respective picture formula (Pictevent).
Global text tags, on the other hand, as the name suggests, are valid everywhere in the project.
In addition to event functions (Length, Pos, Str and Val, see below in this chapter), text tags can be edited in the following way:
Editing of individual letters of a global text tag: If a process tag field is assigned to a text tag (see chapter Dynamizing text), each letter can be edited individually in the formula interpreter. The field element “0” contains the ASCII value of the first letter, the field element “n-1” the ASCII value of the last letter. The “0” must be in the “nth” field element as the end of the string identifier.
Note
The creation of a process tag field is described in the chapter “Process point definition” (field size (#) described.
Editing of individual letters of a local text tag: Local text tags can also be edited letter by letter using ASCII values. The first tag element contains the ASCII value of the first, the penultimate tag element the ASCII value of the last letter. In the last tag element, the “0” must be the end of string identifier.
Copy of local or global text tags: Textvar2 + Textvar3
Compare the content of two text tags: if Textvar1= Textvar2 then …
Concatenation of local or global text tags: Textvar2 + Textvar3
Write constant text in a local or global text tag: Textvar2: = ‘This is a constant text’Textvar1: = ‘constant part A’ + Textvar2 + ‘constant part B’
Note
“Text tags and process tags must differ in their name. The same applies to local and global text tags
AppendString¶
Function to append a number to a string and another string that can be used as a separator for concatenation
Function definition: AppendString(v1 : real, Mode1, Mode2 : integer, StrSeparator, StrDest : string) : integer
Parameter: |
|
---|---|
v1 |
Tag of the data to be written with format specification, up to 20 places |
v1 = tag [: field width [: decimal place]] |
|
Mode1 |
0 = with spaces (depending on the format specification) |
1 = with zeros in front of the decimal point (depending on the format specification) |
|
Mode2 |
0 = decimal places from the format specification |
1 = decimal places from the process tag declaration |
|
StrSeparator |
Constant or variable string that can be used as a separator for concatenation |
StrDest |
String to which the data is appended |
Return values: |
|
0 |
Data attached |
-1 |
Parameter error |
-2 |
too many characters in the string |
Note
A maximum of 4095 characters are allowed in a string. For global text tags, the maximum number of characters is 255 characters.
DateToStr¶
Function for converting date and time information into a string.The conversion is specified by a format string.
The function converts the transferred value of the Time () function taking into account the daylight-saving time offset and the time zone offset. For example, if the function is given a value from the Time (8) function, the current time is obtained as a string. A string is obtained as UTC time via the Time (12) parameter.
Function definition: DateToStr(InputSec : real, Format, Destination : string) : integer
Parameter: |
|
---|---|
InputSec |
Process variable with absolute seconds value (Time (8) or Time(12)) |
Format |
String variable for time formatting The following format characters are defined: |
h = hours |
|
m = minutes |
|
s seconds |
|
d = day |
|
m= month |
|
y = year |
|
Destination |
String in which the output is written |
Return values: |
|
:- |
:- |
0 |
String created |
-1 |
Parameter error |
Important
The Time () and DateToStr () functions work with second values.
In contrast to this, the system variable “$ Current.UTCTime” and the number field display with the format “Date / Time” work with millisecond values. If necessary, a conversion must be made here.
Format identifiers that only consist of one character must be expanded with a preceding space (example: “f” -> “f”).
Note
The format string can also be used without a separator (eg:, /). This is useful for file names with a date (e.g., file X01031998).
GetSubString¶
The function returns a substring from a source string. It extracts the substring from a start address and ends the substring as soon as the transferred separator has been found.
If the separator is not found, the return value is -2 and the substring is returned with the source string from the start address to the end of the string.
If an invalid parameter is passed or the start address is outside the source string, the substring is not touched.
If a value is already contained in the variable when the function is called, it is retained after the function.
Function definition: GetSubString(Quell, Sub, Separator : string, Start : integer) : integer
Parameter: |
|
---|---|
Source |
Source string from which the substring is extracted |
Sub |
Variable in witch the the substring is written into |
Separator |
Separator where the substring ends |
Start |
Starting position at which, the substring begins |
Return values: |
|
>= 0 |
Position of the found seperator |
-1 |
Parameter error |
-2 |
Separator not found |
-3 |
Start address is outside the source string |
Length¶
Function for determining the length of a string.
Function definition: Length(Source : string) : integer
Parameter: |
|
---|---|
Source |
Name of the source string |
Return values: |
|
>= 0 |
Number of signs |
<0 |
if error |
Pos¶
Function to search for a string in a string.
Function definition: Pos(Sub, Source : string) : integer
Parameter: |
|
---|---|
Sub |
Name of the string to be searched for |
Source |
Name of the string to be searched for |
Return values: |
|
>= 0 |
Position of the substring in a string |
<0 |
f not found |
Str¶
Function for converting a number into a string. The format can be commited as well.
Function definition: Str(Source : real, Destination : string) : integer
Parameter: |
|
---|---|
Source |
Variable of the data to be written with format specification, up to max. The following applies in general: |
Source = variable [: field width [: decimal places]] |
|
Destination |
Name of the target string |
Return values: |
|
>= 0 |
when converted |
<0 |
if not converted |
Important
The field width only specifies the minimum width, i.e., if the number to be converted is larger than the minimum field width, the entire number will still be converted into a string!Example: Field width 1 decimal place 1 number to be converted 22
Ist die Feldbreite größer als die Zahl, wird String am Anfang mit 0 aufgefüllt Bei Feldbreite 3 wird aus 22 ein String „022“ Damit auf String wieder gleicher Wert kommt kann alternativ der Befehl AppendString mit Mode1=0 verwendet werden.
Val¶
Convert a string to a number in the integer variable transferred as “Interrupt”, VAL saved the position of the character in “Source” at which the conversion was aborted in PROCON-WIN. Today the “Interupt” parameter is ignored during execution but must be specified in the function!
Val automatically skips leading spaces. If a string contains the following character combination ‘12.13’, the value 12.13 is assigned to the process variable.
Important
The string to be converted may only contain numbers, periods or commas! If it contains other characters, the function is not executed.The interrupt parameter must be specified but it is not evaluated!
Alternatively, the functions StringToInt or StringToReal be used
Function definition: Val(Source : string, Value : real, Interrupt : integer) : integer
Parameter: |
|
---|---|
Source |
Name of the source string |
Value |
Name of the num. variable for value |
Interrupt |
Conversion information (is not evaluated) |
Return values: |
|
none, but variable code shows the conversion status |
|
> = 0 |
when converted |
< 0 |
if not converted |
StringToUpper¶
Function for converting a string to upper case.
Function definition: StringToUpper(var string:text) : integer
Parameter: |
|
---|---|
StrSrc |
Variable to be converted |
Return values: |
|
0 |
when converted |
<0 |
if not converted |
StringToLower¶
Function for converting a string to lower case
Function definition: StringToLower(var string:text) : integer
Parameter: |
|
---|---|
StrSrc |
Variable to be converted |
Return values: |
|
0 |
when converted |
<0 |
if not converted |
StringTrim¶
Removes all named positions (left, right or both sides) where the letter to be removed occurs in a string.
Function definition: StringTrim(var string: strSrc, integer: type, string(char):v1…vn) : integer
Parameter: |
|
---|---|
StrSrc |
String on which the trim command is to be used |
Type |
Type of trimming (1 = left, 2 = right, 3 = left and right) |
V1…n |
One or more characters to be removed |
Return values: |
|
-3 |
TrimType was not found |
-2 |
List of characters to be removed is incorrect |
-1 |
Unhandled error |
0 |
If function was carried out successfully |
StringTemplate¶
Function for inserting values into a character string
Function definition: StringTemplate(var string: strSrc (string,integer,real, Boolean:v1…vn) : integer
Parameter: |
|
---|---|
StrSrc |
String to be formatted |
V1…n |
One or more characters to be inserte |
Return values: |
|
-2 |
Format ist not correct (not available in IoT |
-1 |
Unhandled error |
0 |
If function was carried out successfully |
StringReplace¶
Function for replacing a Unicode character or a string in a character string
Function definition: StringReplace(var string: strSrc real, Boolean:v1…vn) : integer
Parameter: |
|
---|---|
StrSrc |
String in which the Unicode characters are to be replaced |
OldValue |
The character or string to be replaced |
NewValue |
The replacing character or string |
Return values: |
|
-1 |
Unhandled error |
0 |
If function was carried out successfully |
StringToInt¶
Function for converting a string into an integer
Function definition: StringToInt(string: strSrc, var integer:intDest) : integer
Parameter: |
|
---|---|
StrSrc |
Name of the source string |
IntDest |
Name of the target intege |
Return values: |
|
-1 |
Picture change not possible |
0 |
If function was carried out successfully |
StringToReal¶
Function for converting a string into a number with decimal places. Representation only possible with a point and no comma, as this corresponds to the international standard
Function definition: StringToReals(string: strSrc, var integer:realDest) : integer
Parameter: |
|
---|---|
StrSrc |
Name of the source string |
RealDest |
Name of the target rea |
Return values: |
|
-1 |
Picture change not possible |
0 |
If function was carried out successfully |
IsNumeric¶
Function to query whether an expression can be evaluated as a number.
Function definition: IsNumeric(string: strSrc) : integer
Parameter: |
|
---|---|
StrSrc |
Name of the source string |
Return values: |
|
-1 |
Is no real or integer |
0 |
If function was carried out successfully |
StringFormat¶
Function for formatting an integer / real that is formatted according to the instructions in a string format expression
Function definition: StringFormat(string: strSrc, string format, [var]destString) : integer
Parameter: |
|
---|---|
Source |
Integer / Real to be formatted |
Format |
A valid format string expression |
DestString |
Name of the target string |
Return values: |
|
-3 |
Format is not correct |
-2 |
Is no integer oder real |
-1 |
Unhandled error |
0 |
If function was carried out successfully |
StringRegExIsMatch¶
Function to query whether the regular expression finds a match in the specified input string
Function definition: StringRegExIsMatch(string: strSrc, string pattern) : integer
Parameter: |
|
---|---|
StrSrc |
The string to search for a match |
Pattern |
The regular expression pattern to match |
Return values: |
|
-3 |
A regular expression parsing error occurred (not present in IoT) |
-2 |
Timeout (not available in IoT |
-1 |
When the regular expression does not find a match |
0 |
When the regular expression finds a match |
StringIndexOf¶
Function returns the zero-based index of the first occurrence of a specified Unicode character or Unicode string
Function definition: StringIndexOf(string: strSrc, string pattern) : integer
Parameter: |
|
---|---|
StrSrc |
The string to search in |
Pattern |
The string to searc |
Return values: |
|
-1 |
The string to search for was not found |
>0 |
Function returns the zero-based index of the first occurrence |
StringStartsWith¶
Function to query whether the beginning of this string instance matches the specified string
Function definition: StringStartsWith(string: strSrc, string comString) : integer
Parameter: |
|
---|---|
StrSrc |
The string to search in |
ComString |
The string to compare |
Return values: |
|
-1 |
String does not start with the string to be compared |
0 |
String starts with the string to be compared |
StringEndsWith¶
Function to query whether the end of this string instance matches the specified string
Function definition: StringEndsWith(string: strSrc, string comString) : integer
Parameter: |
|
---|---|
StrSrc |
The string to search in |
ComString |
The string to compare |
Return values: |
|
-1 |
String does not end with the string to be compared |
0 |
String ends with the string to be compared |
StringInsert¶
Function to insert a string at the specified index position in the current string
Function definition: StringInsert(string: strSrc, integer:startIndex, string:insertValue) : integer
Parameter: |
|
---|---|
StrSrc |
The string to search in |
startIndex |
The string to compare |
insertValue |
The value to insert |
Return values: |
|
-2 |
Starting index is too high or too little |
-1 |
Unhandled error |
0 |
If function was carried out successfully |
StringRemove¶
Function to remove a specified number of characters from the current string
Function definition: StringRemove(string: strSrc, integer:position, integer:count) : integer
Parameter: |
|
---|---|
StrSrc |
Name of the source string |
Position |
Position of the deletion (1 = left, 2 = right, 3 = left and right) |
Count |
Number of characters to be deleted |
Return values: |
|
-3 |
Position was not found |
-2 |
Count not correct |
-1 |
Unhandled error |
0 |
If function was carried out successfully |
Math and calculation functions¶
Sqrt¶
Function to calculate the square root
Function definition: Sqrt(Value : real) : real
Parameter: |
|
---|---|
Value |
Value from which the square root is drawn |
Return values: |
|
Function value |
Square root |
Ln¶
Function for calculating the natural logarithm
Function definition: Ln(Value : real) : real
Parameter: |
|
---|---|
Value |
Value to be logarithmised |
Return values: |
|
Function value |
Logarithm of the value |
Exp¶
Function to calculate the power e ^ x
Function definition: Exp(Value : real) : real
Parameter: |
|
---|---|
Value to be raised to the power |
|
Return values: |
|
Function value |
natural power of the value |
Log¶
Function to calculate the 10th logarithm
Function definition: Log(Value : real) : real
Parameter: |
|
---|---|
Value |
Value to be logarithmised |
Return values: |
|
Function value |
10er logarithm of the value |
Pow¶
Function to calculate a power x ^ y
Function definition: Pow(XValue, YValue : real) : real
Parameter: |
|
---|---|
XValue |
Basis for potentiation |
YValue |
Exponent for potentiation |
Return values: |
|
Function value |
Value for potentiation |
Abs¶
Function for calculating the absolute value. The absolute value function assigns its absolute value to every real number
Function definition: Abs(Value : real) : real
Parameter: |
|
---|---|
Value |
Value for the amount function |
Return values: |
|
Function value |
Real value |
Trigonometrical function¶
Sin¶
Function for calculating the sine value from an angle value
Function definition: Sin(Value : real) : real
Parameter: |
|
---|---|
Value |
Angle value in rad between 0 and 2 PI |
Return values: |
|
Function value |
Sine value |
Cos¶
Function for calculating the cosine value from an angle value
Funktionsdefinition: Cos(Value : real) : real
Parameter: |
|
---|---|
Value |
Angle value in rad between 0 and 2 PI |
Return values: |
|
Function value |
Cosine value |
Tan¶
Function for calculating the tangent value from an angle value
Function definition: Tan(Value : real) : real
Parameter: |
|
---|---|
Value |
Angle value in rad between -PI / 2 and PI / 2 |
Return values: |
|
Function value |
Tangent value |
Arcsin¶
Function for calculating the arc sine value from an angle value
Function definition: Arcsin(Value : real) : real
Parameter: |
|
---|---|
Value |
Value between -1 and 1 |
Return values: |
|
Function value |
Arc sine value |
Arccos¶
Function for calculating the arccosine value from an angle value
Function definition: Arccos(Value : real) : real
Parameter: |
|
---|---|
Value |
Value between -1 and 1 |
Return values: |
|
Function value |
Arccosine value |
Arctan¶
Function for calculating the arctangal value from an angle value
Function definition: Arctan(Value : real) : real
Parameter: |
|
---|---|
Value |
between -infinite and + infinite |
Return values: |
|
Function value |
Arc tangent value |
Arctan2¶
Function for calculating the arctangle value with two parameters.In contrast to the Arctan, it can observe the signs of both parameters and thus determine the quadrant of the result.
Function definition: Arctan(Value1, Value2 : real) : real
Parameter: |
|
---|---|
Value1 |
between -infinite and + infinite |
Value2 |
between -infinite and + infinite |
Return values: |
|
Function value |
Arc tangent 2 value |
Sinh¶
Function for calculating the hyperbolic sine value from an angle value.
Function definition: Sinh(Value : real) : real
Parameter: |
|
---|---|
Value |
Real numbers |
Return values: |
|
Function value |
Hyperbolic sine value |
Cosh¶
Function for calculating the hyperbolic cosine value from an angle value
Function definition: Cosh(Value : real) : real
Parameter: |
|
---|---|
Value |
Real numbers |
Return values: |
|
Function value |
Hyperbolic cosine value |
Tanh¶
Function for calculating the hyperbolic tangent value from an angle value.
Function definition: Cosh(Value : real) : real
Parameter: |
|
---|---|
Value |
Real numbers |
Return values: |
|
Function value |
Hyperbolic tangent value |
Time & date functions¶
The following formatting works only in SCADA Systems.
Format specifier |
Description |
Examples |
---|---|---|
“ d” |
The day of the month, from 1 to 31 |
2009-06-01T13:45:30 -> 1 |
2009-06-15T13:45:30 -> 15 |
||
“dd” |
The day of the month, from 1 to 31 |
2009-06-01T13:45:30 -> 01 |
2009-06-15T13:45:30 -> 15 |
||
“ddd” |
The abbreviated name of the day of the week |
2009-06-15T13:45:30 -> Mon. |
“dddd” |
The full name of the day of the week |
2009-06-15T13:45:30 -> Monday |
“ f” |
The tenths of a second in a date and time value |
2009-06-15T13:45:30.6170000 -> 6 |
2009-06-15T13:45:30.05 -> 0 |
||
“ff” |
The hundredth of a second in a date and time value |
2009-06-15T13:45:30.6170000 -> 61 |
2009-06-15T13:45:30.0500000 -> 00 |
||
“fff” |
The milliseconds in a date and time value |
6/15/2009 13:45:30.617 -> 617 |
6/15/2009 13:45:30.0005 -> 000 |
||
“ffff” |
The ten-thousandths of a second in a date and time value |
2009-06-15T13:45:30.6175000 -> 6175 |
2009-06-15T13:45:30.0000500 -> 0000 |
||
“fffff” |
The hundred thousandths of a second in a date and time value |
009-06-15T13:45:30.6175400 -> 61754 |
6/15/2009 13:45:30.000005 -> 00000 |
||
“ffffff” |
The millionth of a second in a date and time value |
2009-06-15T13:45:30.6175420 -> 617542 |
2009-06-15T13:45:30.0000005 -> 000000 |
||
“fffffff” |
The ten millionth of a second in a date and time value |
2009-06-15T13:45:30.6175425 -> 6175425 |
2009-06-15T13:45:30.0001150 -> 0001150 |
||
“ F” |
If not equal to zero, the tenths of a second in a date and time value |
2009-06-15T13:45:30.6170000 -> 6 |
2009-06-15T13:45:30.0500000 -> (no output) |
||
“FF” |
If not equal to 0 (zero), the hundredths of a second in a date and time value |
2009-06-15T13:45:30.6170000 -> 61 |
2009-06-15T13:45:30.0500000 -> (no output) |
||
“FFF” |
If nonzero, the milliseconds in a date and time value. |
2009-06-15T13:45:30.6170000 -> 617 |
2009-06-15T13:45:30.0500000 -> (no output) |
||
“FFFF” |
If non-zero, the ten-thousandths of a second in a date and time value |
2009-06-15T13:45:30.5275000 -> 5275 |
2009-06-15T13:45:30.0500000 -> (no output) |
||
“FFFFF” |
If nonzero, the hundred thousandths of a second in a date and time value |
2009-06-15T13:45:30.6175400 -> 61754 |
2009-06-15T13:45:30.0500000 -> (no output) |
||
“FFFFFF” |
If not zero, the millionth of a second in a date and time value |
2009-06-15T13:45:30.6175420 -> 617542 |
2009-06-15T13:45:30.0500000 -> (no output) |
||
“FFFFFFF” |
If not equal to zero, the ten millionths of a second in a date and time value |
2009-06-15T13:45:30.6175425 -> 6175425 |
2009-06-15T13:45:30.0001150 -> 000115 |
||
“ g”, “gg” |
The period |
2009-06-15T13:45:30.6170000 -> A.D. |
“ h” |
The hour, from 1 to 12 (12-hour format) |
2009-06-15T01:45:30 -> 1 |
2009-06-15T13:45:30 -> 1 |
||
“hh” |
The hour, from 01 to 12 (12-hour format) |
2009-06-15T01:45:30 -> 01 |
2009-06-15T13:45:30 -> 01 |
||
“ H” |
The hour, from 0 to 24 (24-hour format) |
2009-06-15T01:45:30 -> 1 |
2009-06-15T13:45:30 -> 13 |
||
“HH” |
The hour, from 00 to 23 (24-hour format) |
2009-06-15T01:45:30 -> 01 |
2009-06-15T13:45:30 -> 13 |
||
“ K” |
Time zone information |
With DateTime values |
2009-06-15T13:45:30, type not specified -> |
||
2009-06-15T13:45:30, UTC time zone -> Z |
||
2009-06-15T13:45:30, local time zone -> -07:00 (depends on the local computer settings) |
||
WithDateTimeOffset()Values: |
||
2009-06-15T01:45:30-07:00 –> -07:00 |
||
2009-06-15T08:45:30+00:00 –> +00:00 |
||
“ m” |
The minute, from 0 to 59 |
2009-06-15T01:09:30 -> 9 |
2009-06-15T13:29:30 -> 29 |
||
“mm” |
The minute, from 00 to 59 |
2009-06-15T01:09:30 -> 09 |
2009-06-15T01:45:30 -> 45 |
||
“M” |
The month from 1 to 12 |
2009-06-15T13:45:30 -> 6 |
“MM” |
The month from 01 to 12 |
2009-06-15T13:45:30 -> 06 |
“MMM” |
The abbreviated name of the month |
2009-06-15T13:45:30 -> Jun |
“MMMM” |
The full name of the month |
2009-06-15T13:45:30 -> June |
“ s” |
The second, from 0 to 59 |
2009-06-15T13:45:09 -> 9 |
“ss” |
he second, from 00 to 59” |
2009-06-15T13:45:09 -> 09 |
“ t” |
The first character of the AM / PM identifier |
2009-06-15T13:45:30 -> P (en-US) |
“tt” |
The AM / PM qualifier |
2009-06-15T13:45:30 -> PM |
“ y” |
The year, from 0 to 99 |
0001-01-01T00:00:00 -> 1 |
0900-01-01T00:00:00 -> 0 |
||
1900-01-01T00:00:00 -> 0 |
||
2009-06-15T13:45:30 -> 9 |
||
2019-06-15T13:45:30 -> 19 |
||
“yy” |
The year, from 00 to 99 |
0001-01-01T00:00:00 -> 01 |
0900-01-01T00:00:00 -> 00< |
||
1900-01-01T00:00:00 -> 00 |
||
2019-06-15T13:45:30 -> 19 |
||
“yyy” |
The year, with a minimum of three digits |
0001-01-01T00:00:00 -> 001 |
0900-01-01T00:00:00 -> 900 |
||
1900-01-01T00:00:00 -> 1900 |
||
2009-06-15T13:45:30 -> 2009 |
||
“yyyy” |
The year as a four-digit number |
0001-01-01T00:00:00 -> 0001 |
0900-01-01T00:00:00 -> 0900 |
||
1900-01-01T00:00:00 -> 1900 |
||
2009-06-15T13:45:30 -> 2009 |
||
“yyyyy” |
The year as a five-digit number |
0001-01-01T00:00:00 -> 00001 |
2009-06-15T13:45:30 -> 02009 |
||
“ z” |
Offset from UTC in hours, without leading zeros |
2009-06-15T13:45:30-07:00 -> -7 |
“zz” |
Offset from UTC in hours, with a leading zero for a single-digit value |
2009-06-15T13:45:30-07:00 -> -07 |
“zzz” |
Offset from UTC in hours and minutes |
2009-06-15T13:45:30-07:00 -> -07:00 |
“ :” |
The time separator |
2009-06-15T13:45:30 -> : (en-US) |
2009-06-15T13:45:30 -> .(it-IT) |
||
2009-06-15T13:45:30 -> : (ja-JP) |
||
“ /” |
The date separator |
2009-06-15T13:45:30 -> / (en-US) |
2009-06-15T13:45:30 -> - (ar-DZ) |
||
2009-06-15T13:45:30 -> .(tr-TR) |
||
“Zeichenfolge” |
Literal string separator |
2009-06-15T13:45:30 (“arr:” h:m t) -> arr: 1:45 P |
% |
Defines the next character as a user-defined format specifier |
2009-06-15T13:45:30 (%h) -> 1 |
The escape character |
2009-06-15T13:45:30 (h h) -> 1 h |
|
Any other sign |
The character is copied unchanged into the result string |
2009-06-15T01:45:30 (arr hh:mm t) -> arr 01:45 A |
Please note, that Embedded Systems uses different formatting than SCADA. The following formatting works in Embedded Systems:
Formatter |
Description |
---|---|
%a |
The abbreviated weekday name of the locale |
%A |
The abbreviated weekday name of the locale |
%b |
The locale’s full weekday name |
%B |
The locale’s full weekday name |
%c |
The locale’s date and time representation. The modified command %c produces the locale’s alternate date and time representation |
%C |
The year divided by 100 using floored division. If the result is a single decimal digit, it is prefixed with O. The modified command %OC produces the locale’s alternative representation of the century. |
%d |
The day of month as a decimal number. If the result is a single decimal digit, it is prefixed with O. The modified command %Od produces the locale’s alternative representation. |
%D |
Equivalent to %m/%d/%y |
%e |
The day of month as a decimal number. If the result is a single decimal digit, it is prefixed with a space. The modified command %Oe produces the locale’s alternative representation. |
%F |
Equivalent to %Y-%m-%d |
%g |
The last two decimal digits of the ISO week-based year. If the result is a single digit it is prefixed by 0. |
%G |
The ISO week-based year as a decimal number. If the result is less than four digits it is left-padded with 0 to four digits. |
%h |
Equivalent to %b |
%H |
The hour (24-hour clock) as a decimal number. If the result is a single digit, it is prefixed with 0. The modified command %OH produces the locale’s alternative representation |
%I |
The hour (12-hour clock) as a decimal number. If the result is a single digit, it is prefixed with 0. The modified command %OI produces the locale’s alternative representation. |
%j |
The day of the year as a decimal number. Jan 1 is 001. If the result is less than three digits, it is left-padded with 0 to three digits. |
%m |
The month as a decimal number. Jan is 01. If the result is a single digit, it is prefixed with 0. The modified command %Om produces the locale’s alternative representation. |
%M |
The minute as a decimal number. If the result is a single digit, it is prefixed with 0. The modified command %OM produces the locale’s alternative representation. |
%n |
A newline character |
%p |
The locale’s equivalent of the AM/PM designations associated with a 12-hour clock. |
%r |
The locale’s 12-hour clock time |
%R |
Equivalent to %H:%M |
%S |
Seconds as a decimal number. If the number of seconds is less than 10, the result is prefixed with 0. If the precision of the input can not be exactly represented with seconds, then the format is a decimal floating point number with a fixed format and a precision matching that of the precision of the input (or to a microseconds pwjhljrecision if the conversion to floating point decimal seconds can not be made within 18 fractional digits). The character for the decimal point is localized according to the locale. The modified command %OS produces the locale’s alternative representation. |
%t |
A horizontal-tab character |
%T |
Equivalent to %H:%M:%S |
%u |
The ISO weekday as a decimal number (1-7), where Monday is 1. The modified command %Ou produces the locale’s alternative representation |
%U |
The week number of the year as a decimal number. The first Sunday of the year is the first day of week 01. Days of the same year prior to that are in week 00. If the result is a single digit, it is prefixed with 0. The modified command %OU produces the locale’s alternative representation. |
%V |
The ISO week-based week number as a decimal number. If the result is a single digit, it is prefixed with 0. The modified command %OV produces the locale’s alternative representation. |
%w |
The weekday as a decimal number (0-6), where Sunday is 0. The modified command %Ow produces the locale’s alternative representation. |
%W |
The week number of the year as a decimal number. The first Monday of the year is the first day of week 01. Days of the same year prior to that are in week 00. If the result is a single digit, it is prefixed with 0. The modified command %OW produces the locale’s alternative representation. |
%x |
The locale’s date representation. The modified command %Ex produces the locale’s alternate date representation. |
%X |
The locale’s time representation. The modified command %Ex produces the locale’s alternate time representation. |
%y |
The last two decimal digits of the year. If the result is a single digit it is prefixed by 0. |
%Y |
The year as a decimal number. If the result is less than four digits it is left-padded with 0 to four digits. |
%z |
The offset from UTC in the ISO 8601 format. For example -0430 refers to 4 hours 30 minutes behind UTC. If the offset is zero, +0000 is used. The modified commands %Ez and %Oz insert a : between the hours and minutes: -04:30. |
%Z |
The time zone abbreviation |
%% |
A % character |
Examples of embedded systems formatting:
Formatter |
Result |
---|---|
%H:%M:%S %d.%m.%Y |
14:20:30.00000000 23.07.2021 |
%H:%M:%OS %d.%m.%Y |
14:20:30 23.07.2021 |
%I:%M:%OS %d.%m.%Y %p |
02:30:39 28.07.2021 PM |
%FT%H:%M |
2021-07-23T14:20 |
%c |
Wed Jul 28 14:31:48 2021 |
%A %B %Y |
Wednesday July 2021 |
%T %Z |
14:36:38.000000000 UTC |
AbsToTime¶
Function for determining the date and time information from an absolute system time since 1.1.1970.” The output format is the same as the input format, means that if milliseconds are entered, they will also be marked with , if they are not recorded when entered, the output value only in seconds
Function definition: AbsToTime(AbsTime : real, Day, Month, Year, Hour, Minute, Second, Millisecond : integer) : integer
Parameter: |
|
---|---|
AbsTime |
Absolute system time in seconds since 1.1.1970 |
Day |
Day Variable that receives the day of the month 1..31 as a value |
Month |
Day Variable that receives the day of the year 1..12 as a value |
Year |
Day Variable that receives the year 1970..2038 as a value |
Hour |
Variable that receives the hour of the day 0..23 as a value |
Minute |
ariable that receives the minute of the hour 0..59 as a value” |
Second |
Variable that receives the second of the minute 0..59 as a value |
Millisecond |
Variable that receives the millisecond of the second 0..999 as a value |
Return values: |
|
>= 0 |
if ok |
< 0 |
Incorrect parameterisation |
TimeToAbs¶
Function to determine the system time in seconds since 1.1.1970.
Function definition: TimeToAbs(Day, Month, Year, Hour, Minute, Second, Millisecond : integer) : real
Parameter: |
|
---|---|
Day |
Day of month 1..31 |
Month |
Month of the year 1..12 |
Year |
Year 1970..2038 |
Hour |
Hour of the day 0..23 |
Minute |
Minute of the hour 0..59 |
Second |
Second of the minute 0..59 |
Millisecond |
Millisecond of the second 0..999 |
Return values: |
|
>= 0 |
if no error occurs, it returns the time value |
< 0 |
Incorrect parameterisation |
Time¶
Function for reading out the current system time in individual components
Function definition: Time(Index : integer) : integer
Parameter: |
|||
---|---|---|---|
Index |
Index of the time entry |
Area |
|
0 |
Day |
1..31 |
|
1 |
month |
1..12 |
|
2 |
year |
1970… |
|
3 |
Day of the week 0 = Sunday |
0..6 |
|
4 |
Day of the year |
1..365 |
|
5 |
Hour of the day |
0..23 |
|
6 |
Minute of the hour |
0..59 |
|
7 |
Second of the minute |
0..59 |
|
8 |
Time in seconds since 1970 |
0..2^31 |
|
9 |
Milliseconds |
0..999 |
|
10 |
Time in seconds since 1970 with daylight saving time offset without time zone offset |
0..2^31 |
|
11 |
Time in seconds since 1970 with time zone offset without daylight saving time offset |
0..2^31 |
|
12 |
Time in seconds since 1970 without time zone offset and daylight-saving time offset (supplies UTC time) |
0..2^31 |
Return values: |
|
---|---|
-1 |
if index is not valid |
otherwise |
the value of the time entry |
TimeUtcToLocal¶
Converts the absolute time from UTC time to local time. Assumes that the specified time is UTC.
Function definition: TimeUTCToLocal(Var integer : absTime)
Parameter: |
|
---|---|
AbsTime |
Absolute system time in seconds since 1.1.1970 |
Return values: |
|
-1 |
if index is not valid |
0 |
if the function was carried out successfully |
TimeLocalToUtc¶
Converts the absolute time from local time to UTC time. Assumes the given time is local
Function definition: TimeLocalToUtc(Var integer : absTime)
Parameter: |
|
---|---|
AbsTime |
Absolute system time in seconds since 1.1.1970 |
Return values: |
|
-1 |
if index is not valid |
0 |
if the function was carried out successfully |
DateAdd¶
Function for adding specific time periods to the absolute system time.
Function definition: DateAdd(Var integer AbsTime, integer Version, integer Addition)
Parameter: |
|
---|---|
AbsTime |
Absolute system time in seconds since 1.1.1970 |
Version |
Numerical differentiation of the type of addition |
0 |
Milliseconds |
1 |
Seconds |
2 |
Minutes |
3 |
Hours |
4 |
Days |
5 |
months |
6 |
years |
Addition |
Numerical amount which is added |
Return values: |
|
-2 |
wrong version |
-1 |
Incorrect parameterisation |
0 |
if the function was carried out successfully |
DateStringAdd¶
Function for adding specific time periods to the absolute system time.
Function definition: DateStringAdd(Var string: Date,string : Format, integer Version, integer Addition)
Parameter: |
|
---|---|
Date |
Date which is taken as the basis |
Version |
Numerical differentiation of the type of addition |
0 |
Milliseconds |
1 |
Seconds |
2 |
Minutes |
3 |
Hours |
4 |
Days |
5 |
months |
6 |
years |
Addition |
Numerical amount which is added |
Return values: |
|
-3 |
Wrong format |
-2 |
wrong version |
-1 |
Incorrect parameterisation |
0 |
if the function was carried out successfully |
DateToString¶
Function for converting date and time information into a string. Exact on 1 second
Function definition: DateToString(integer: AbsTime,string : Format, Var string: Date)
Parameter: |
|
---|---|
AbsTime |
Absolute system time in seconds since 1.1.1970 |
Format |
Format of the date string |
Date |
Formatted date |
Format |
Parameter DateTime |
Return values: |
|
-3 |
Wrong format |
-2 |
Date is too big (not available in IoT |
-1 |
Incorrect parameterisation |
0 |
if the function was carried out successfully |
DateToAbs¶
Function for converting a date in string format to an absolute value
Function definition: DateToAbs(string: Date,string : Format, Var integer: AbsTime)
Parameter: |
|
---|---|
Date |
Formatted date |
Format |
Format of the date string |
AbsTime |
Absolute system time in seconds since 1.1.1970 |
Format |
Parameter DateTime |
Return values: |
|
-2 |
Wrong format |
-1 |
Incorrect parameterisation |
0 |
if the function was carried out successfully |
TimespanToString (onlySCADA)¶
Function to convert milliseconds to seconds, hours, and minutes
Function definition: TimespanToString(integer: Milliseconds, string: Format, Var string: Timespan)
Parameter: |
|
---|---|
Milliseconds |
Milliseconds to convert |
Format |
Format string of the time span |
Timespan |
Time span as a string |
Return values: |
|
-3 |
Wrong format |
-2 |
The date is too big |
-1 |
Incorrect parameterisation |
0 |
if the function was carried out successfully |
User management functions (only SCADA)¶
Login¶
Function for logging in (registering) a user
Important
This command only works for registered clients, ie in a local script!This command will not work in a script that is executed when the system is started, since the web server is not yet accepting any client requests!
Function definition: Login(User, Password : string) : integer
Parameter: |
|
---|---|
User |
Name of the user |
Password |
Password of the user |
Return values: |
|
1 |
Login successful, new password required the next time you log in |
0 |
if the function was carried out successfully |
-1 |
Access denied |
-2 |
Unknown user / password |
-3 |
Incorrect password entry, account will be blocked if you enter the wrong password again |
-4 |
Account gesperrt |
-5 |
Account blocked |
Logout¶
Function for logging out the current user.
Important
This command only works for registered clients, ie in a local script!This command will not work in a script that is executed when the system is started, since the web server is not yet accepting any client requests!
Function definition: Logout() : integer
Return values: |
|
---|---|
0 |
if the function was carried out successfully |
-1 |
if no logout is possible |
The following functions for user management are now also available:
SetUserPassword
CreateUser
DeleteUser
SetUserGroup
GetUserGroup
SetUserInfo
GetUserInfo
Important
It is important to note that the functions are ALWAYS carried out in the respective context of the executing user, therefore the functions currently only work in the context of a client,
ie they can be executed e.g. by button clicks or image scripts within a client in the context of the logged on user but NOT as global tasks, as there is no user in the server context with whom the user management could request permission to process the functio
Important
Example: There are 2 clients in the system:
Client1, user “admin” logged on. It is in the “Administrators” user group, which has the right to create users (system rights-> user management -> (5) create new users)
Client2, user “guest” logged on. He is in the “Guests” user group, which does NOT have the right.If Client1 executes the CreateUser () function, a new user is created if this was not yet available and noError (0) is returned as the result
If Client2 executes the CreateUser () function, NO new user is created because the user “guest” does not have the right to do so and permissionDenied (-1) is returned as an error. This would also happen if a global task executed the function because there is no valid user for verification.
All functions return the same return values that are returned directly from PROCONWEB’s user administration. Of course, some error codes only exist in special contexts, but these are all possible error codes that can occur with the functions.
With every error code <> noError (0) the desired functionality was NOT executed.Like the other system functions, all functions return 0 if they have been processed successfully, otherwise one of the following error codes is returned:
Error code |
Return value |
Description |
---|---|---|
noError |
0 |
Function carried out successfully |
permissionDenied |
-1 |
No permission to perform the function |
unkno wnUserOrWrongPassword |
-2 |
Unknown user or wrong password |
wrong PasswordAccountClosed |
-3 |
Wrong User password, account was deactivated |
accountClosed |
-4 |
Account is deactivated |
passwordExpired |
-5 |
password is expired |
nameAlreadyUsed |
-6 |
The name is already in use |
invalidUserInfo |
-7 |
Invalid user info |
changeUserDenied |
-8 |
No permission to modify the user |
password PolicyNotRespected |
-9 |
The password policies were not adhered to |
passwordAlreadyUsed |
-10 |
The password has already been used |
groupUnknown |
-11 |
Unknown user group |
group AssignmentNotAllowed |
-12 |
Group assignment is not permitted |
deleteUserNotAllowed |
-13 |
Deleting the user is not allowed |
deleteUser NotAvailable |
-14 |
The user to be deleted does not exist |
deleteUserNotPossible |
-15 |
It is not possible to delete the user |
duplicateIdentCode |
-16 |
The IdentCode already exists |
languageNotAvailable |
-17 |
The requested language does not exist |
unknown |
-99 |
Unknown error in user management |
CreateUser¶
With this function a user can be created with the passed password. Further attributes of the user can only be set after a user has been created using the SetUserInfo () function
The right (5) User administration -> Create new user is required for this function
If the function is carried out successfully, the logbook entry 10000004 New user is created.
Function definition: CreateUser(Username: string, Password: string) : integer
Parameter: |
|
---|---|
Username |
Username for the new user |
Password |
Initial password for the new user |
Return values: |
|
0 |
if the function was carried out successfully |
Or one of the general errors in user administration (see table above) |
DeleteUser¶
With this function a user can be deleted.The right (2) User administration -> Change user is required for this functionIf the function is executed successfully, the logbook entry 10000005 user is deleted and create
Function definition: DeleteUser(Username: string) : integer
Parameter: |
|
---|---|
Username |
Username for the user to be deleted |
Return values: |
|
0 |
if the function was carried out successfully |
Or one of the general errors in user administration (see table above) |
SetUserPassword¶
This function can be used to set a new password for a user. If password guidelines are defined, the password to be set must correspond to the password guidelines
The right (3) User administration -> Change password of other users is required for this functionIf the function is carried out successfully, the logbook entry 10000007 password is changed, generated
Since the function is intended to change the password of another user, the password is set independently of the password history.
Function definition: SetUserPassword(Username: string, Password: string) : integer
Parameter: |
|
---|---|
Username |
Username for which the password should be set |
Password |
New password for the new user |
Return values: |
|
0 |
if the function was carried out successfully |
Or one of the general errors in user administration (see table above) |
GetUserGroup¶
This function can be used to check whether a user is assigned to a user group or not.
Important
ATTENTION: To be able to use the function in the sense of a Boolean query, the return values have been changed:A 1 is returned if the user belongs to the user group, 0 if not. In the event of an error, one of the error codes
Function definition: GetUserGroup(Username: string, Groupname: string, CountryCode: string) : integer
Parameter: |
|
---|---|
Username |
Username of the user who should be checked whether he is assigned to a group |
Groupname |
Name of the user group |
CountryCode |
Country code of the group name |
(e.g., 049 for German, or the value of the system variable __CurrentLanguage) |
|
Return values: |
|
0 |
if the user does not belong to the group |
1 |
If the user belongs to the group |
Or one of the general errors in user administration (see table above) |
SetUserGroup¶
With this function a user can be assigned to a user group (mode = 1) or removed from it (mode = 2).
The right (6) User administration -> Assign foreign group is required for this functionIf the function is carried out successfully, the logbook entry 10000006 User was changed is generated
Function definition: SetUserGroup(Username: string, Groupname: string, Modus : integer, CountryCode: string) : integer
Parameter: |
|
---|---|
Username |
Username of the user to be assigned to a group |
Groupname |
Name of the user group |
Modus |
Mode 1: Assign users to a grou |
Mode 2: Remove users from a group |
|
CountryCode |
Country code of the group name |
(e.g., 049 for German, or the value of the system variable __CurrentLanguage) |
|
Return values: |
|
0 |
if the function was carried out successfully |
Or one of the general errors in user administration (see table above) |
GetUserInfo¶
With this function, an attribute of a user can be read out and written to a process variable.The following attributes can be read out and if the attribute is not marked as “readonly” it can also be changed with the SetUserInfo () function. The following attribute IDs are available:
ID |
Description |
Variable type |
---|---|---|
0 |
Name of the user |
string |
1 |
ID of the user, internal only, readonly |
string |
2 |
Full name of the user |
string |
3 |
description of the user, multilingual |
string |
4 |
Time of last login, readonly |
Numeric (milliseconds since 1970) |
5 |
Status (1 = active, 2 = inactive) |
numerically |
6 |
Password aging active |
bool |
7 |
Password must be changed the next time you log in |
bool |
8 |
Identcode for token authentication |
string |
9 |
Identcode active (can be used for login) |
bool |
10 |
NotificationType (for notifiaction) |
numerically |
11 |
Email address of the user |
string |
12 |
Telephone number of the user |
string |
13 |
Mobile phone number of the user |
|
14 |
Flag whether the user is an LDAP user |
bool |
15 |
Default language of the user |
string |
16 |
With Identcode, show login anyway |
bool |
The description of the user is multilingual; if it is to be set for several languages, the function must be called several times, each with the corresponding country code as a parameter
The country code must be entered as text as the default language of the user, e.g. 049 for German or 044 for English. The country code is configured in the designer when selecting the language.
The following types are available for setting the NotificationType (see Notification):
NotificationType |
Description |
---|---|
4 |
Voice |
28 |
CityCall |
44 |
SMS GSM |
66 |
Voice ISDN |
85 |
CityCall ISDN |
10000 |
Email WithNumerInSubject |
10001 |
|
20000 |
Sipgate SMS |
Function definition: GetUserInfo(Username: string, InfoId: integer, var variable: undef, CountryCode: string) : integer
Parameter: |
|
---|---|
Username |
Username of the user whose info is to be read |
InfoID |
ID of the attribute (see table above) |
Variable |
Process variable of the appropriate type (string, num, bool) |
CountryCode |
Country code of the group name |
(e.g., 049 for German, or the value of the system variable __CurrentLanguage) |
|
Different values are only supplied for the InfoID for the description |
|
Return values: |
|
0 |
if the function was carried out successfully |
Or one of the general errors in user administration (see table above) |
SetUserInfo¶
This function can be used to change an attribute of a recipe.
The attributes listed for the GetUserInfo () function can be set if they are not marked as “readonly”. Attempting to write a readonly attribute leads to error 7 - invalid user infoThe right (2) User administration -> Change user is required for this function
If the function is carried out successfully, the logbook entry 10000006 User was changed is generated
Function definition: SetUserInfo(Username: string, InfoId: integer, variable: undef, CountryCode: string) : integer
Parameter: |
|
---|---|
Username |
Username of the user whose info is to be written |
InfoID |
ID of the attribute (see table Attributes of the GetUserInfo function) |
Variable |
Process variable of the appropriate type (string, num, bool) |
CountryCode |
Country code of the group name |
(e.g., 049 for German, or the value of the system variable __CurrentLanguage) |
|
Different values are only supplied for the InfoID for the description |
|
Return values: |
|
0 |
if the function was carried out successfully |
Or one of the general errors in user administration (see table above) |
Image processing function¶
If the image processing functions are called by a client (image or control events), the corresponding image processing functions are only executed for this client. If the functions are executed in global scripting (global tasks), the image processing functions are executed for ALL currently logged on clients. For example, system-wide messages can be displayed on all clients
For images with image-related scripts (cycle script), this is processed in the following cases:
When opening the image, e.g. via a button
For the open image, set this to “invisible”
When opening a picture in a picture areas and set this to “invisible”
When closing and emptying an image area, the script is not processedThis also applies to the previous functions that can now be run again.
Important
All functions currently always return the value 0!
AddPicture¶
Function for adding a process picture at a certain position and with a defined size on the screen.
Important
This command only works for registered clients, ie in a local script!This command will not work in a script that is executed when the system is started, since the web server is not yet accepting any client requests!
Important
AddPicture unterstützt ab der Version 6.8 nur den 2. Parameter (Number) sowie den 3. und 4. optionalen Paremeter (XPos und YPos)
Function definition: AddPicture(Picture, Number, XPos, YPos, Width, Height, Flags: integer): integer
Parameter: |
|
---|---|
Picture |
Number of the picture from which to add |
Number |
Number of the picture to be added |
XPos, YPos |
|
|
|
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
if parameterisation error |
-2 |
if added image does not exist |
-3 |
if user level is too low |
ChangePicture¶
Function for changing to another process picture.
Important
This command only works for registered clients, ie in a local script!This command will not work in a script that is executed when the system is started, since the web server is not yet accepting any client requests!
Function definition: ChangePicture(PictNumberOld, PictNumberNew : integer): integer
Parameter: |
|
---|---|
PictNumberOld |
Image number of the image to be switched from, image number from 0 to 65520 |
PictNumberNew |
Number of the picture to be switched to; Picture number from 0 to 65520 |
XPos, YPos |
|
|
|
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
Picture change not possible |
-3 |
The picture number of the picture to be switched from is invalid |
NewPicture¶
Function for adding a process picture or function for changing to another process picture.
Important
This command only works for registered clients, ie in a local script!This command will not work in a script that is executed when the system is started, since the web server is not yet accepting any client requests!
Function definition: NewPicture(Function, PictNumber : integer): integer
Parameter: |
|
---|---|
Function |
0 = adding a new picture |
1 = Function for changing all pictures |
|
PictNumber |
Number of the picture to be added |
The picture number from 0 to 65520 |
|
XPos, YPos |
position of the picture (left upper corner) on |
the screen, if the process picture, position of the picture (left upper corner) |
|
in the father window if child picture |
|
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
if window was not found |
-2 |
if function is not correct |
-3 |
if picture number is not correct |
OpenPicture¶
This function can be used to open a picture based on the picture name or the picture number. The parameter is always a string but can contain either the picture name or the picture number as a string.
Important
This command only works for registered clients, ie in a local script!This command will not work in a script that is executed when the system is started, since the web server is not yet accepting any client requests!
Function definition: OpenPicture(PictureNameOrNumber : string): integer
Parameter: |
|
---|---|
PictureNameOrNumber |
Name or number of the picture as a string |
Return values: |
|
0 |
If function was carried out successfully |
-1 |
Image could not be loaded (image not found / available) |
-2 |
Picture is already opened |
-3 |
Calling up the picture is already in progress and was called up again |
ClosePicture¶
This function can be used to close a picture based on the picture name or the picture number. The parameter is always a string but can contain either the picture name or the picture number as a string.
Important
This command only works for registered clients, ie in a local script!This command will not work in a script that is executed when the system is started, since the web server is not yet accepting any client requests!
Function definition: ClosePicture(PictureNameOrNumber : string): integer
Parameter: |
|
---|---|
PictureNameOrNumber |
Name or number of the picture as a string |
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
Image could not be closed (image not found / available) |
PrintPicture¶
This function can be used to print an image based on the image name or number. The parameter is always a string but can contain either the picture name or the picture number as a string.
Important
This command only works for registered clients, ie in a local script!This command will not work in a script that is executed when the system is started, since the web server is not yet accepting any client requests!
Function definition: PrintPicture(PictureNameOrNumber : string): integer
Parameter: |
|
---|---|
PictureNameOrNumber |
Name or number of the picture as a string |
Return values: |
|
0 |
if the function was carried out successfully |
ChangeAllPictures¶
This function closes all visible images and opens the new image. The parameter is always a string but can contain either the picture name or the picture number as a string.
Important
This command only works for registered clients, ie in a local script!This command will not work in a script that is executed when the system is started, since the web server is not yet accepting any client requests!
Function definition: ChangeAllPictures(PictureNameOrNumber : string): integer
Parameter: |
|
---|---|
PictureNameOrNumber |
Name or number of the picture as a string |
Return values: |
|
0 |
if the function was carried out successfully |
FillPictureArea¶
This command deletes the content of a PictureArea and refills it with the specified images.
Important
This command only works for registered clients, i.e., in a local script!This command will Not work in a script that is executed at system start, since the web server does not yet accept any client requests!However, the command may Not be called cyclically, as this leads to a high system load!
Funktionsdefinition: FillPictureArea(PictureAreaId, PictureList : string): integer
Parameter: |
|
---|---|
PictureAreaId |
Name of the PictureArea instance in the picture |
PictureList |
List of image names with which the area should be filled. The names must be separated by semicolons |
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
Image area with the given name was not found |
-2 |
Several image areas with the same name have been found |
-3 |
An error occurred while loading / assigning the images (image not found / available) |
FillImageView¶
Deletes an ImageView, refills it with the specified graphics and displays the graphic with the corresponding index.The image file must be stored in the WebVisu directory of the project directory. Alternatively, transfer the files from outside to the WebVisu directory with a startup scriptto be copied in.
Important
This command only works for registered clients, ie in a local script!This command will Not work in a script that is executed at system start, since the web server does not yet accept any client requests!The instance of the ImageView must be unique within the project!
Function definition: FillImageView(ImageViewId, ImageList : string, Index : integer): integer
Parameter: |
|
---|---|
ImageViewId |
Name of the ImageView instance in the picture |
ImageList |
List of graphic names with which the area should be filled. The names must be separated by semicolons |
Index |
Index of the graphic to be displayed. The index is based on 0 and must be between 0 and the number of transferred graphics - 1 |
Return values: |
|
0 |
if the function was carried out successfully |
Process variable functions¶
ReadFromProcess¶
With this function, the process variables used in the script are currently read from the TagServer.The sync parameter can be used to define whether reading is synchronous or asynchronous. With synchronous reading, the script waits until all values have been read and then continues processing.
Attention
A synchronous reading can be very time-consuming as the process variables are synchronized up to the controller
Important
ReadFromProcess should only be used in exceptional cases, since the ScriptServer already reads at the beginning of a script and unnecessary reading of process variables should be avoided for performance reasons for all context switches to other servers (data management, alarming, …).
Function definition: ReadFromProcess(Sync: integer) : integer
Parameter: |
|
---|---|
Sync |
1: reads the values from the process synchronously, ie the script waits to process until all values have been returned1: reads the values from the process synchronously, ie the script waits to process until all values have been returned |
<> 1: reads the values asynchronously, ie reading the values is triggered, but the script processing continues without waiting until the values have actually been read |
|
Return values: |
|
1 |
if the function was successfully completed |
WriteToProcess¶
With this function, the process variables used in the script are currently written to the TagServer.The sync parameter can be used to define whether reading is synchronous or asynchronous. With synchronous writing, the script waits until all values have been written and then continues processing.
Attention
Synchronous writing can be very time-consuming since the process variables are synchronised up to the controller.
Important
WriteToProcess should only be used in exceptional cases, since the ScriptServer is already writing at the end of a script and unnecessary writing of process variables should be avoided for performance reasons for all context switches to other servers (data management, alarming, …).
Function definition: WriteToProcess(Sync: integer) : integer
Parameter: |
|
---|---|
Sync |
1: writes the values synchronously with the process, ie the script waits to process until all values have been written |
<> 1: writes the values asynchronously, ie the writing of the values is triggered, but the script processing continues without waiting until the values have actually been written |
|
Return values: |
|
1 |
if the function was successfully completed |
GetTagProperty¶
The new tag properties can be read or written with the two script functions GetTagProperty and SetTagProperty. The functions can also be used to describe the properties Min, Max, MinSPS, MaxSPS and the number of decimal places for numerical values.
Attention
If process variables are used exclusively in scripting via the dynamicfunctions GetValue (), SetValue ()GetTagProperty () and SetTagProperty () and NOWHERE else in the project, they will be recognized by the designer as not referenced, since access to these functions is dynamic works at runtime via the name and NOT via a fixed reference.
This can be seen when all references of the process variable are displayed, and these are then empty and thus the variable is not exported for the runtime.This leads to the return value -2 at runtime for the functions mentioned above.
The following TagProperties can be addressed via their ID:
Name |
ID |
Note |
---|---|---|
Min |
200 |
Type numeric, only valid for numeric process variables |
Max |
201 |
Type numeric, only valid for numeric process variables |
MinExt |
202 |
Type numeric, only valid for numeric process variables |
MaxExt |
203 |
Type numeric, only valid for numeric process variables |
DecimalPlaces |
205 |
Type numeric, only valid for numeric process variables |
Num1 |
500 |
Type numeric |
Num2 |
510 |
Type numeric |
Num3 |
520 |
Type numeric |
Num4 |
530 |
Type numeric |
Bool1 |
540 |
Type logical |
Bool2 |
550 |
Type logical |
String1 |
560 |
Type text |
String2 |
570 |
Type text |
The following additional TagProperties can be READONLY addressed via their ID:
Name |
ID |
Note |
---|---|---|
Name |
1 |
Type text |
ID |
2 |
Type numeric |
Size |
3 |
Type numeric, array length or string length, otherwise 1 |
DriverID |
4 |
Type numeric, number of the driver |
DefaultValue |
5 |
Type numerical, logical or text, depending on the process variable |
Access |
6 |
Type numeric, 1 = write, 2 = read, 3 = readwrite |
External Access |
7 |
Type numeric, 0 = none, 1 = write, 2 = read, 3 = readwrite, if access is via OPC UA server |
Type |
8 |
Type numeric, 1 = logical, 2 = numeric, 3 = text |
Driver parameters |
9 |
Type text |
Driver connection |
10 |
Type numeric, for connection-oriented drivers |
Display name |
11 |
Type text, name in the currently set language |
Display comment |
12 |
Type text, comment in the currently set language |
UnitName |
13 |
Type text, name of the unit |
Unit |
14 |
Type text, unit in the currently set language |
Unit description |
15 |
Type text, description of the unit in the currently set language |
Comment |
16 |
Type text, configuration comment |
Function definition: GetTagProperty(TagName: string, PropertyId: integer, Value: var undef) : integer
Parameter: |
|
---|---|
TagName |
Name of the process variable |
PropertyId |
Id / Number of the property |
Value |
Value of the property |
boolean for logical properties |
|
real for logical properties |
|
string for text properties |
|
Only real variables, not instances, may be used |
|
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
General error |
-2 |
invalid process variable |
-3 |
invalid property |
SetTagProperty¶
The new tag properties can be read or written with the two script functions GetTagProperty and SetTagProperty. The functions can also be used to describe the properties Min, Max, MinSPS, MaxSPS and the number of decimal places for numerical values.
For the parameters of the tag properties see function GetTagProperty.
Important
When setting a range property (Min, Max, MinExt, MaxExt, DecimalPlaces) of a numeric variable, the current variable value can be adjusted. Furthermore, when changing e.g. the maxvalue of arrays, all tags are adjusted to the new max value. If this should only happen for one element, the index must be specified.
Attention
If process variables are used exclusively in scripting via the dynamicfunctions GetValue (), SetValue ()GetTagProperty () and SetTagProperty () and NOWHERE else in the project, they will be recognized by the designer as not referenced, since access to these functions is dynamic works at runtime via the name and NOT via a fixed reference.
This can be seen when all references of the process variable are displayed, and these are then empty and thus the variable is not exported for the runtime.This leads to the return value -2 at runtime for the functions mentioned above.
Function definition: SetTagProperty(TagName: string, PropertyId: integer, Value: var undef) : integer
Parameter: |
|
---|---|
TagName |
Name of the process variable |
PropertyId |
Id / Number of the property |
Value |
Value of the property |
boolean for logical properties |
|
real for logical properties |
|
string for text properties |
|
Only real variables, not instances, may be used |
|
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
invalid process variable |
-2 |
invalid property |
GetValue¶
Function for querying variable values using the variable name, which can also be assembled dynamically.If the variable is NOT in the current requirements list, it is automatically transferred to the requirements list for the period of execution.
Array elements can be queried using the complete specification including the array index, e.g. ‘TestNumArr [3]’ asks the 4th Element of the ‘TestNumArr’ array.
Attention
If process variables are used exclusively in scripting via the dynamicfunctions GetValue (), SetValue ()GetTagProperty () and SetTagProperty () and NOWHERE else in the project, they will be recognized by the designer as not referenced, since access to these functions is dynamic works at runtime via the name and NOT via a fixed reference.
This can be seen when all references of the process variable are displayed, and these are then empty and thus the variable is not exported for the runtime.This leads to the return value -2 at runtime for the functions mentioned above.
Function definition: GetValue (TagName: string, Mode: integer, VarNameResult: undef) : integer
Parameter: |
|
---|---|
TagName |
Name of the variable to be queried |
Numerical, logical process variable or text variable as string constant or variable |
|
Mode |
0 The function is processed asynchronously, the current value is returned |
1 The function is processed synchronously, ie with driver variables there is a wait until a fetsch-cycle has been processed |
|
VarNameResult |
Value of the variable to be queried |
Only real variables, not instances, may be used |
|
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
Parameter error |
-2 |
Process variable not found |
Important
The TagServer reads the value of the variable directly from the process.If the variable was previously used in the script, the value is normally not yet available in the process, unless, for example, a WriteToProcess () was carried out
SetValue¶
Function for setting a variable value via the variable name, which can also be assembled dynamically.If the variable is NOT in the current requirements list, it is automatically transferred to the requirements list for the period of execution.
Array elements can be queried using the complete specification including the array index, e.g. ‘TestNumArr [3]’ asks the 4th Element of the ‘TestNumArr’ array.
Attention
If process variables are used exclusively in scripting via the dynamicfunctions GetValue (), SetValue ()GetTagProperty () and SetTagProperty () and NOWHERE else in the project, they will be recognized by the designer as not referenced, since access to these functions is dynamic works at runtime via the name and NOT via a fixed reference.
This can be seen when all references of the process variable are displayed, and these are then empty and thus the variable is not exported for the runtime.This leads to the return value -2 at runtime for the functions mentioned above.
Function definition: SetValue(TagName: string, Mode: integer, VarNameResult: undef) : integer
Parameter: |
|
---|---|
TagName |
Name of the variable to be queried |
Numerical, logical process variable or text variable as string constant or variable |
|
Mode |
0 The function is processed asynchronously, the current value is returned |
1 The function is processed synchronously, ie with driver variables there is a wait until a fetch cycle has been processed |
|
VarNameResult |
Value of the variable to be queried |
Only real variables, not instances, may be used |
|
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
Parameter error |
-2 |
Process variable not found |
Other functions (only SCADA)¶
Special¶
Funktion zum Auslösen von Sonderfunktionen aus dem Eventcode heraus. Es sind die Sonderfunktionen möglich welche auch auf Symbolen und Buttons möglich sind.
Attention
This command only works for registered clients, ie in a local script!This command will not work in a script that is executed when the system is started, since the web server is not yet accepting any client requests!
Function definition: Special(Picture, number : integer) : integer
Parameter: |
|
---|---|
Picture |
Nummer des Bildes mit der die Funktion aufgerufen wird |
Number |
Number of the special functions |
Return values |
|
0 |
If function was carried out successfully |
External function call / programme start (only SCADA)¶
WinExec¶
Function to run another Windows program from the event code.When using this function, it must be ensured that the program to be executed can actually be started by the operating system. It must either be in the current working directory or in one of the Windows search paths. In addition, the Windows resources must be sufficient when the program starts.
Attention
Since the command line parameters for the program call are separated with spaces, no path specifications with spaces are supported.
Attention
The program is executed in the user context of the PROCON-WEB service, which is usually the local system account. No programs with a user interface should therefore be called that require user interaction.
Function definition: WinExec(CommandLine: string) : integer
Parameter: |
|
---|---|
CommandLine |
Command line for the program call including the start parameters |
Return values: |
|
0 |
if ok |
< 0 |
if error |
-1 |
Parameter not definied |
-2 |
System resources insufficient to execute the command |
-3 |
EXE file is in wrong format |
-4 |
file not found |
-5 |
path not found |
-6 |
undefined error |
Other functions (only SCADA)¶
Delay¶
With this function, the script to be executed can be delayed by the transferred number of milliseconds. The script stops executing for the specified time and continues with the script when the time has elapsed.
Before the script is stopped, all process variables modified by the script are written to the tag server. Before the script continues, the current process tag management is read by the tag server. This means that the process image for the script can have changed while the script is stopped.
Since process communication normally only takes place at the beginning and end of a script, process variables can also be exchanged at a defined point in the script. The process communication can of course represent a performance overhead, for example when using the function within a loop.
Function definition: Delay(Milliseconds : integer) : integer
Parameter: |
|
---|---|
Milliseconds |
Time in milliseconds by which the script is delayed |
Return values: |
|
0 |
if the function was carried out successfully |
LogEventString¶
Function for writing a string in the logbook
Function definition: LogEventString(var StrSrc: string) : integer
Parameter: |
|
---|---|
StrSrc |
Name of the string (max. 255 characters) |
Return values: |
|
>= 0 |
if written |
< 0 |
if not writtten |
SetLanguage¶
Function for setting the current operating language.
Special feature: Setting the operating language leads to a new image structure. A picture event (picture formula) is ended and restarted after the command!
Important
This command only works for registered clients, i.e. in a local script!This command will Not work in a script that is executed at system start, since the web server does not yet accept any client requests!
Function definition: SetLanguage(Country : string) : integer
Parameter: |
|
---|---|
Country |
Country code of the new operating language |
(z.B. 044 für England) |
|
Return values: |
|
0 |
if the function was successfully completed |
-1 |
Parameter error |
-2 |
Sprachkennung nicht vorhanden in Projekt |
Random¶
Function for creating a random number.The random number generator is initialised with the “Randomize” function. If the random number generator is not initialised, the “Random” function always generates the same sequence of random numbers after the program has started
Function definition:** Random(Range : integer) : integer
Parameter: |
|
---|---|
Range |
Range specification for the random number 0 <= Result < Range |
Return values: |
|
Random number |
0 <= result range |
Note
For example, if you want to generate a random number between 70 and 80, you have to generate a random number between 0 and 10 and add an offset of 70.
Randomize¶
Function to initialize the random number generator.If the random number generator is not initialized, the Random function always generates the same sequence of random numbers after the program has started.
Function definition: Randomize() : integer
Note
See also random; Only has to be started once after the project has started (e.g. during initialization).
ChangeProject¶
Function for changing the current project, the runtime is restarted with the new project.
Function definition: ChangeProject(ProjectName: string) : integer
Parameter: |
|
---|---|
ProjectName |
Name of the project to be started |
Return values: |
|
0 |
if the function was carried out successfully |
< 0 |
In case of error |
GetLanguage¶
Function for inquiring about the current operating language.
Function definition: GetLanguage(var SprachIdentifikation, Kurzbezeichnung, Laenderkennung : string) : integer
Parameter: |
|
---|---|
Language identification |
ID of the language, e.g., “de” for German, “en” for English as selected in the designer |
Short name |
Short description of the language as given in the designer |
Country code |
Country code of the current operating language |
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
Parameter error |
OpenBrowser¶
Function to open the transferred URL in a new browser tab or a new browser window. The reason for this is that certain pages such as Google cannot be displayed in iFrames - as is used by the WebBrowser control.
Important
This command only works for registered clients, i.e. in a local script!This command will Not work in a script that is executed at system start, since the web server does not yet accept any client requests!
Function definition: OpenBrowser(Url : string, tab : integer) : integer
Parameter: |
|
---|---|
URL |
URL to be called |
Tab |
0 = new browser window 1 = new tab |
Country code |
Country code of the current operating language |
Return values: |
|
0 |
if the function was carried out successfully |
-1 |
parameterisation error (tab <0 or tab> 1) |
DIN 8743 funktions (only SCADA)¶
CalculateDIN8743¶
See also chapter machine times
Function definition CalculateDIN8743(int Aktion, string Auftrag, string AuftragID, string Unitname, real Start, real Ende, real Modus, real Gutteile, real Schlechtteile)
Parameter |
Meaning |
---|---|
Action 0 |
start of calculation |
1 |
termination of calculation |
2 |
progress query of calculation |
3 |
status query of calculation |
The following parameters are only evaluated with action 0 (start of calculation):
Order: name of the order (user-defined text to identify the calculation)
OrderID: ID of the order (user-defined text to identify the calculation)
Unit name unique name of the unit to be calculated (e.g. ‘Plant structure. Plant.Linie1.Unit1’)
Start: start time of the evaluation in seconds since 1970
End: end time of the evaluation in seconds since 1970
Mode: DIN calculation mode0 = absolute time (end-start) as the basis for calculation1 = machine working time tW as the basis for calculation
The last two parameters can be used to overwrite the number of good or bad parts from the logger table.Values> = 0 overwrite or replace the values determined from the logger table.
Good parts: number of good parts within the calculation period
Bad parts: number of bad parts within the calculation period
Return values for action status query: |
Meaning |
---|---|
-1 |
Error |
0 |
OK or done |
1 |
Calculation is running |
2 |
Calculation canceled |
Return values for action progress query:** |
Meaning |
---|---|
-1 |
Error or calculation aborted |
0 – 100 |
Progress information |
Other return values: |
Meaning |
---|---|
-2 |
unknown unit name |
-3 |
wrong calculation time parameters start and end |
-4 |
a calculation is currently being carried out |
-5 |
nternal calculation error (wrong parameters in the unit definition, etc.) |
-6 |
AlertService is blocked at the moment (e.g. online project update) |
CalculateStatistic¶
See also chapter machine times
Function definition CalculateStatistic(int Aktion, string Auftrag, string AuftragID, string Länderkennung, real Start, real Ende)
Parameter |
Meaning |
---|---|
Action 0 |
start of calculation |
1 |
termination of calculation |
2 |
progress query of calculation |
3 |
status query of calculation |
The following parameters are only evaluated with action 0 (start of calculation):
Order: name of the order (user-defined text to identify the calculation)
OrderID: ID of the order (user-defined text to identify the calculation)
Country code: udesired language of the alarm texts in the results table (e.g. en-EN)
Start: start time of the evaluation in seconds since 1970
End: end time of the evaluation in seconds since 1970
Return values for action status query: |
Meaning |
---|---|
-1 |
Error |
0 |
OK or done |
1 |
Calculation is running |
2 |
Calculation canceled |
Return values for action progress query:** |
Meaning |
---|---|
-1 |
Error or calculation aborted |
0 – 100 |
Progress information |
Other return values: |
Meaning |
---|---|
-3 |
wrong calculation time parameters start and end |
-4 |
a calculation is currently being carried out |
-5 |
nternal calculation error (wrong parameters in the unit definition, etc.) |
-6 |
AlertService is blocked at the moment (e.g. online project update) |
StatisticClose¶
Not implemented anymore
Printer handling¶
Important
The script functions for printer handling are ALWAYS executed on the server, so they always refer to the printer on the server system.
GetPrinterCount¶
With this function the number of printers can be read out from the system.
Function definition: GetPrinterCount() : integer
Return values |
Meaning |
---|---|
0 |
if the function was carried out successfully |
-1 |
Printers cannot be read out |
GetPrinterName¶
Reads out the name of a printer, the index must be between 0 and GetPrinterCount () - 1.
Function definition: GetPrinterName(integer: index, name : var type string) : integer
Parameter |
Meaning |
---|---|
index |
Index of the printer (must be between 0 and GetPrinterCount () - 1) |
name |
Name of the printer |
Return values: |
Meaning |
0 |
if the function was carried out successfully |
-1 |
Printer was not found |
GetDefaultPrinterByIndex¶
Reads out the default printer
Function definition: GetDefaultPrinterByIndex(var integer: index) : integer
Parameter |
Meaning |
---|---|
index |
Index of the printer |
Return values: |
Meaning |
0 |
if the function was carried out successfully |
-1 |
Printer was not found |
GetDefaultPrinterByName¶
Reads out the default printer
Function definition: GetDefaultPrinterByName(var string: name) : integer
Parameter |
Meaning |
---|---|
index |
Index of the printer |
Return values: |
Meaning |
0 |
if the function was carried out successfully |
-1 |
Printer was not found |
SetDefaultPrinterByIndex¶
Changes the default printer
Function definition: SetDefaultPrinterByIndex(integer: index) : integer
Parameter |
Meaning |
---|---|
index |
Index of the printer (must be between 0 and GetPrinterCount () - 1) |
Return values: |
Meaning |
0 |
if the function was carried out successfully |
-1 |
Printer was not found |
SetDefaultPrinterByName¶
Changes the default printer
Funktionsdefinition: SetDefaultPrinterByName(string: name) : integer
Parameter |
Meaning |
---|---|
index |
Index of the printer (must be between 0 and GetPrinterCount () - 1) |
Return values: |
Meaning |
0 |
if the function was carried out successfully |
-1 |
Default printer could not be set |
Structure functions¶
Copy structures¶
Structures are treated throughout scripting like C# reference. This means that when structures are copied, a reference is assigned, but not the values themselves. This can be enabled in the script configuration.

When writing to tag structures, copying must always be done via a script function. If this does not happen, a system alarm is triggered to indicate this.
CopyStruct¶
Copies all elements of the source structure and their substructure to the target structure. The length is not changed by default but can be adjusted via the parameter “overrideLength”.
Function definition: CopyStruct(target: struct, source: struct, [overrideLength]:boolean) : integer
Parameter |
Meaning |
---|---|
target |
Name of the target structure |
source |
Name of the source structure |
overrideLength |
Determines whether array length is preserved |
Return values: |
Meaning |
0 |
if the function was carried out successfully |
-1 |
if target and source structure have different types |
GetStructValue¶
Function for querying structure values via the name of the structure instance, which can also be assembled dynamically. Subtrees can also be accessed if they are specified with a period. It is also possible to query on arrays as a whole or individual elements of them.
Function definition: GetStructValue(structName: string, mode: integer, structValue: struct)
Parameter |
Meaning |
---|---|
structName |
Name of the structure to be queried |
mode 0 |
Function is processed asynchronously, the currently current value is returned |
mode 1 |
Function is processed synchronously, i.e., driver variables are waited until a Fetsch cycle has been processed |
structValue |
Value of the structure to be queried |
Return values: |
Meaning |
0 |
if the function was carried out successfully |
-1 |
if target and source structure have different types |
-2 |
if no variable is found due to the optimized process variable export |
SetStructValue¶
Function to write structure values via the name of the structure instance, which can also be assembled dynamically. Subtrees can also be accessed if they are specified with a period. Arrays as a whole or individual elements of them can also be queried. The length of the array cannot be changed.
Function definition: SetStructValue(structName: string, mode: integer, structResult: struct)
Parameter |
Meaning |
---|---|
structName |
Name of the structure to be queried |
mode 0 |
Function is processed asynchronously, the currently current value is returned |
mode 1 |
Function is processed synchronously, i.e., driver variables are waited until a Fetsch cycle has been processed |
structResult |
Value of the structures to be written to |
Return values: |
Meaning |
0 |
if the function was carried out successfully |
-1 |
if target and source structure have different types |
-2 |
if no variable is found due to the optimized process variable export |
GetStructInstances¶
Function to ask for the nameof all instances of a structure, which can also be assembled dynamically. The length of the passed array is automatically adjusted.
Function definition:
GetStructInstances(structTypeName: string, instances: array of string): integer
Parameter |
Meaning |
---|---|
structTypeName |
Name of the structure to be queried |
mode 0 |
Function is processed asynchronously, the currently current value is returned |
mode 1 |
Function is processed synchronously, i.e., driver variables are waited until a Fetsch cycle has been processed |
structValue |
Value of the structure to be queried |
Return values: |
Meaning |
0 |
if the function was carried out successfully |
-1 |
if the structure could not be found |
Dynamic structures¶
For scripts that are started from a client and not, for example, automatically when the Visu starts, dynamic structures can be accessed with “DynStruct.`<StructClassName>`”. This works for AOs with structure assignment and for images opened by an AO with structure. if a structure is used for which no matching instance can be determined at run time the structure is set to a new empty instance before the script is executed.For scripts that are started from a client and not, for example, automatically when the Visu starts, dynamic structures can be accessed with “DynStruct.`<StructClassName>`”. This works for AOs with structure assignment and for images opened by an AO with structure. if a structure is used for which no matching instance can be determined at run time the structure is set to a new empty instance before the script is executed.
Script-Debugger¶
General¶
The script component of the PROCON-WEB Designer has been expanded to include the functionality of a debugger. The debugger can debug individual scripts in a simulation session, or it is possible to connect to a local script server (attach) in order to debug its live process flow.The functions of the script debugger can be accessed via the script toolbar when the script to be debugged is opened in the designer:

The following functions are available for starting a debug session:
Toggle breakpoint (F9): This can be used to set or delete a breakpoint at the current code position (position in the script where the input cursor is positioned). If there is no breakpoint at this point, one is set; if a breakpoint already exists, it is deleted.
Breakpoints can be set or removed before a debug session as well as during a debug session.It should be noted, however, that starting a debug session without previously set breakpoints can result in the scripts being processed before a breakpoint is set and the breakpoint is therefore not reached.
Start simulation (F6): Starts a debug session within a script simulation process.
A simulation environment is started in the background that processes each script once. In this simulation there is no runtime connection to server components. All special script functions are treated as if their processing would return the result 1 (S_OK).
Attach ScriptServer (Ctrl-F6): Starts a debug session in which the debugger connects to the actually running script server in a local runtime environment.
With this function, the scripts currently running live in runtime can be debugged. In this scenario, some exceptions must be observed that can have a fundamental influence on the runtime system!
Important
With live coupling, all the tags modified in the debugger (process tags or local script tags) are written directly to the script server of the runtime system and can thus influence the process and the execution of the scripts!
Important
Long debugging sessions in a breakpoint can lead to timeouts within the runtime system in the case of a live connection, so that, for example, client scripts are not executed correctly at this time or server communications are aborted due to the timeouts and not restarted.
Important
Since the debugger directly intervenes in the process of the script server with live coupling, it can remain in a state after the end of a debug session that does not ensure that the scripts continue to run correctly. To be on the safe side, the ScriptServer should therefore be restarted after a ScriptServer debug session.
The following functions are available during a debug session:
Continue simulation (F6): If the session is in a breakpoint, processing can be continued with F6. This works both for simulation sessions and for live sessions against the script server. Here the function Continue Simulation (F6) and Continue ScriptServer (CTRL-F6) are identical.
Continue ScriptServer (CTRL-F6): See “Continue Simulation (F6).
Step In (F11): Only available if the debug session is in a breakpoint.Jumps to the next line of script. If this is a function call, a branch is made to this function, otherwise Step In behaves like Step Over (F10).
Step over (F10): Only available if the debug session is in a breakpoint. Jumps to the next line of script.
Step out (CTRL-F11): Only available if the debug session is in a breakpoint.Jumps from the current function to the one above. If the current line of code is in the main function (PROGRAM), Step Out behaves like Step Over (F10)
Toggle breakpoint (F9): Same functionality as before the start of a debug session (see above)
Stop (Shift-F6): Ends the debug session. If a simulation session was started, it is ended. If a live script server session has been started, an attempt is made to detach the debugger from the script server so that the script server continues to run normally. However, this cannot be 100% guaranteed in all situations (see above)
Breakpoints¶
Any number of breakpoints can be set in any script. These are displayed in a list in the lower area of the script editor of the designer.

Breakpoints are displayed as red circles in the editor and the line is highlighted in red.

Breakpoints can be activated / deactivated with F9 or with a mouse click in the script editor in which the red circles are displayed.
Watchlist¶
During a debug session, the variables used (process variables and local variables) of the script in which the debug session is currently located are displayed. The values of the variables can be changed accordingly for test purposes

Note
Variable values can only be displayed if the debug session is in a breakpoint.
Background informationen¶
Here is some background information that may help you better understand the sequence of debug sessions and the behavior of the debugger
The PROCON-WEB script, the syntax of which is based on the PASCAL programming language, is converted by the PROCON-WEB Designer into C # .NET code and compiled into a .NET assembly when a project is exported. This Dll (GTI.ProjectSpecificSkripts.dll) is then loaded by the ScriptServer in the runtime and the code of this Dll is executed directly as .NET code.
The debugger functionality that is now used is the same technology as a “normal” debugger on a Windows machine. When debugging, the currently executed C # .NET code is always “mapped” to the most suitable PROCON-WEB script program line. Since the PASCAL-like function-oriented code differs significantly from the object-oriented .NET C # code, in certain cases it can mean, that the line of code cannot be clearly identified.
The use of normal debug technology in a debug session can cause the problems listed above, especially when attaching to a script server that is currently running. Therefore, live debugging is a very delicate matter, especially in a production runtime system, where you must reckon with restarting the runtime system after the debug session has ended.
To determine which session triggers a debug call, a few participants can be defined in the script configuration for which a breakpoint is triggered during debugging.
The entry must be made in the ServerConfigs.xml in the runtime directory in the line
<special key ="DebugSessions" value ="localhost;ScriptServer"/>
Possible entries:
Attendees |
Description |
---|---|
Localhost |
The locoalhost client |
ScriptServer |
ScriptServer-Session for global tasks |
ScriptServer-TaskName |
ScriptServer session for a special task |
Nondedicated |
Not dedicated clients |
ATTENTION: this will trigger ALL non-dedicated clients the breakpoint |
|
Participant name |
The name of a taught client (not case sensitive) |
Use .Net DLL in scripts (only SCADA)¶
General¶
CLR classes can now also be imported into PROCON-WEB scripts. An assembly written in a .NET language (eg C #) must be selected within the designer. After the assembly has been made known, any namespace of this assembly can be imported into a script. All supported classes can then be used in the script.
The method signature is decisive for the usability of a CLR method in a script. This must meet some restrictions. Only public and static methods are supported. In addition, the types of the parameters and the return type can only be script-compatible types.Generic methods, ref / out parameters, or overloaded methods are not supported.
Valid (C #) return types |
Valid (C #) parameter types |
---|---|
bool |
int |
float |
double |
bool[] |
int[] |
float[] |
double[] |
Void |
string[] |
If structures are to be transferred to a CLR method, the dynamic keyword in C # can be used or the dll “GTI.ProjectSpecific.Skripts.Types.dll” generated by the designer can be used, which generates the corresponding interfaces for all tag structures.
program
import Testassembly
var x, y : integer
begin
y := 3
x := MyClass.MyStaticFuncWithInteger(y)
end
Project tree¶

There is the entry in the script area (.Net Dll) in the project tree.
Views¶
The display of the dlls (and pdb files) contained in the project is divided into two areas

The dlls are listed in a grid on the left. Creating, editing etc. works exactly as known from the area of file management. The methods with parameters and return values that can be called are displayed on the right. To do this, you have to select the desired DLL in the left area.
All files required for the script are now exported in the project directory to the “ScriptDllsDesigner” subfolder.
Method¶
The .NET Dll “GTI.SampleDotNet” is integrated into a project as an example. More information can be requested by our support via E-Mail <support@gti.de>
The DLL provides an exemplary order class (OrderHandling) which is intended to simulate a link to an external order management system.
It provides functions for generating an OrderID, an order name and a function that a suitable PROCON-WEB TagStruktur instance takes over and returns initialized in a type-safe manner.The example structure looks like this:

It was a folder structure defined with the elements:ID (Num)Desiredpiece (Num)Actualpiece (Num)Name (string)Comment (string)
And an instance called “OrderInst” was created for the structure
The project is then compiled and created, which creates the file: “GTI.ProjectSpecific.Skripts.Types.dll” in the project subfolder ScriptDllsDesigner.
This Dll is referenced in the exemplary .NET Dll (Visual Studio 2015, C # Class Library, .NET Framework 4):

Die Klasse OrderHandling bietet u.a. die folgende Schnittstelle (TagStrukturen werden immer als Referenz übergeben und können in der Methode modifiziert werden).
// type safe GetOrder Function
public static void GetOrder(GTI.ProjectSpecificSkripts.IOrder order)
{
order.ID = GetNewOrderId();
order.Name = GetProduct();
order.SollStueck = GetStueckzahl();
order.Comment = "Generated by GTI.SampleDotNet.dll C# Code";
}
This Dll is now registered in the Designer under .NET Dlls:

A transferred order is thus initialized and returned.The associated Pascal script with which the OrderInst instance is initialized looks like this:
PROGRAM
import GTI.SampleDotNet (\* .NET Namespace of the used class \*)
BEGIN
(\* OrderHandling is the name of the class
InitOrder() is the public static method of the class
OrderInst is the Tag-Structur-Instanz \*)
OrderHandling.InitOrder( OrderInst )
END
The script is triggered in the project via a button and initializes the job.