Geo SCADA Knowledge Base
Access vast amounts of technical know-how and pro tips from our community of Geo SCADA experts.
Link copied. Please paste this link to share this article on your social media post.
Originally published on Geo SCADA Knowledge Base by Anonymous user | June 09, 2021 09:45 PM
📖 Home Back
This article highlights some of the most common errors made when using the automation interface to connect and manipulate the database of a ClearSCADA server.
You should use an error handler to trap the errors and deal with them in an elegant manner. The code segment below shows an example of how to trap errors in VB or VBA.
'be careful using this line - error handling is now up to you
On Error Resume Next
...
'try and connect
objserver.connect "system name", "username", "password"
'now display any error message
msgbox Err.Description
One of these errors will occur if you attempt to modify the properties of an object where the user credentials supplied to connect to the system do not have sufficient permissions required to perform the function. An example of this is where you attempt to modify an object property, but the user account used to connect via the automation interface does not have Configuration permissions for the specified object.
To correct this error, either modify the security permissions on the server to allow the required permission, or change the user account used to connect to the automation interface to one that has sufficient permissions for the tasks attempted.
This error message occurs if the programmer attempts to access the properties of an object that has not been assigned. If is good programming practice to test for correct assignment as shown in the following example:
Set obj = objServer.FindObject("Something that does not exist") 'the object does not exist
If obj Is Nothing Then 'No object was found so display an error
messageMsgBox "Error: object not found"
Else
'do something useful with the object
End If
If the programmer did not test for "Is Nothing", then attempting to manipulate obj would cause this error.
This error is produced when you attempt to create a new object in a location in the database that does not exist. The second parameter of the CreateObject method is the location in which the object will be created. Ensure that this location exists before calling the CreateObject method.
This error can occur when an attempt is made via the automation interface to write to a read-only property of an object.
Before trying to write to any object properties, it is important to know whether they are writeable. The ClearSCADA database schema (http://127.0.0.1/schema) provides a list of all the database classes, object types and properties. Each property will be listed along with whether or not the field is writeable. Please refer to the ClearSCADA documentation for further details on the database schema.
This error message occurs if the programmer attempts to read or write to a property of an object, or call a method on an object that doesn't exist. To correct this error, refer to the database schema for details of available object properties and ensure that the automation interface code uses only the available properties and methods.
Another consideration when porting code from one machine to another, is that the original developer may have used custom fields in the database. Check the original source database to see if the properties used in the code were configured as custom fields.
This error occurs if the programmer attempts to create a new object in the ClearSCADA database using the CreateObject method and specifies a class that does not exist in the database. It is recommended that you check the database schema to determine the names of the classes that exist. The classes available vary from server to server depending on installed driver options.
This message occurs if the programmer attempts to create an object of a class that exists in the database, but is not a creatable class. There are a variety of non-creatable classes in the schema of the database. These can be identified by the absence of a bracketed description after the title when viewed in the database schema on the "All classes" page.
The simplest way to navigate through the database schema and determine what objects can be created is to use the "Createable Classes" pages (this is shown by default).
This error occurs if the programmer attempts to create a database object in a group that is a template instance. Ensure that you only try to create objects in groups or templates. Do not attempt to create objects in template instances.
This error will occur if you attempt to rename an object and define a full path name during this process. Since the "." character represents a folder level in the full object name, you cannot create define an object name to contain a period ("."). If you want to redefine the location of the object, use the Move method on the object, or simply create it in the correct location as part of the CreateObject method call.
This error occurs if the programmer attempts to delete a database object that is referenced by another object. An example for this would be deleting a point that is displayed on a mimic, or deleting an outstation that has points connected to it.
The DeleteObject method on the server object contains two parameters. The first parameter defines the object to be deleted. The second parameter defines whether or not reference checking is performed by forcing the deletion. If set to False, errors will be generated when references to the object are found. When set to True, references will be broken and the deletion performed.
This error will occur when a user attempts to reference an aggregate on an object that does not exist. Refer to the database schema and verify that the name of the aggregate has been entered correctly and that the aggregate required is valid for the type of object being used.
This error will be returned when the program attempts to write to a property that exists on a disabled aggregate. For example, you cannot configure the compression options of the historic aggregate on a point until the historic aggregate has been enabled. The code below will return an error unless the aggregate has been enabled, or the line oAgg.Enable = True is added before setting the value of the compression property.
Set oAgg = obj.Aggregate("Historic")
oAgg1.Property("Compress") = 1
This error occurs if the programmer attempts to call the PropertyOverride method on an object that is not a Template. Ensure that the object on which you are trying to set property overrides is a template.
This error occurs if the programmer attempts to set a property override using a property name that does not exist. For example, trying to allow an override on the property name "HanddressAllowed" for an internal analog point will work, but the property "HanddressAllowed123" will return the Field not found error.
This error can occur if you try and set a property override on an object that does not reside in the selected template. The PropertyOverride method requires the object ID of the object on which the property overrides are to be enabled / disabled. This object must be within the template.
On an object that is part of a template instance, the programmer cannot write to a property of the object unless the property is overridden at template level. This error occurs if the programmer attempts to write to a property where the property override has not been set. Ensure that all properties you wish to configure on objects in a template instance have the associated property overrides enabled in the template.
Go: Home Back
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.