ClearSCADA

Query the CDBObject Table

 SELECT COUNT( "Id" ) FROM CDBOBJECT

gives the total number of objects that are not in a template. Objects within templates are abstract objects (not 'real' objects). This number may also be limited by the user's permissions, however logic can be used to get complete object count and memory usage figures because logic runs as a high-level user.

 TYPE 
  Result: 
  STRUCT 
   Count : DINT;
   Memory : DINT; 
  END_STRUCT; 
 END_TYPE 

 PROGRAM ObjectCount 
 VAR 
  Objects AT %S(SELECT COUNT(*) AS "Count", SUM(MemoryUsage) AS "Memory" FROM CDBObject) : RESULTSET OF Result; 
  Count AT %M(.ObjectCount.CurrentValue) : DINT; 
  Memory AT %M(.ObjectMemory.CurrentValue) : DINT; 
 END_VAR

  Count := Objects.Value.Count; 
  Memory := Objects.Value.Memory; 
 END_PROGRAM 

The outputs are to internal analog points. Remember to change the Hand Control ranges and FullScale property as necessary so the logic doesn't produce an error when the object or memory count exceeds the maximum ranges allowable.

The memory diagnostics are only a rough guide to memory consumption. They don't account for everything. In the particular case of variables, the memory diagnostic does not extend to include array members.

Use ClearSCADA Server Status Display or Examine Snapshots

The server status item 'Database\Indices\CDBObject\Obj Count' is the total number of objects in the database.

This is also contained in the DB_Snapshot log files in the "Obj Count" column of the "CDBObject" row in the "Database Indices" section.