Server Functions
Server functions allow you to create a script that interacts with the database by:
- Writing a value to an OPC tag
- Reading (and returning) the value of an OPC tag
- Locating (and returning the Name value of) an item in the database.
As the Server functions need to interact with the database, they can only be completed successfully if there is a healthy connection between the client on which the script is running and the server. The connection is made via the XML server using HTTP Port 80 (by default) so that scripts can run correctly on both ViewX and WebX clients. The Port address can be changed via the Server Configuration Tool (see Connection and Update Settings in the ClearSCADA Guide to Server Administration).
The Server functions that are available for you to use in your scripts are:
- Server.GetOPCValue
- Server.SetOPCValue
- Server.FindObject. The FindObject function returns a ServerObject item that also has its own functions and properties that you can use in your script—see ServerObject Functions and ServerObject Properties
- Server.LookUpObject. The LookUpObject function returns a ServerObject item that also has its own functions and properties that you can use in your script—see ServerObject Functions and ServerObject Properties
Each of the Server functions references a Server object, which means that in your script you will need to use the following format to reference them:
Server.<function name>
The Server object also has properties that can be referenced in your script (see Server Properties).