Server Status Dialog:
The first approach (and simplest) is to open the server status dialog by right clicking on the server icon and selecting status. At the bottom of the Info tab, the current license details are shown. This method will list the number of points currently used as well as the total number of points available in the license.
Database Queries:
The second approach to determining a point count is to use the Queries views available in ViewX. Open the Queries views by selecting the queries icon in the toolbar. From the Queries section, double click on the Points table and select OK on the filter dialog to show all points. When the list is displayed, the number of rows in that list (displayed in the status bar at the bottom of the ViewX window) tells the number of points in the system.
For pulse points, repeat the process using the Pulse Actions table. The sum of the two numbers should give the total points.
This same mechanism can be used to determine point counts in any section of the database.
The actual queries run for points and pulses are as follows:
SELECT COUNT(y) FROM CDBPOINT SELECT COUNT(y) FROM CDBPULSE
Logic:
You could use a logic program to store the used points in an internal analog point in the database. This method gets around the possibility of all points not being returned in a query due to permissions, since logic runs under a high level account which has access to all points.
TYPE Result: STRUCT Count : DINT; END_STRUCT; END_TYPE PROGRAM LicenceCount VAR NOCACHE Points AT %S(SELECT COUNT(*) AS "Count" FROM CDBPOINT) : RESULTSET OF Result; Pulses AT %S(SELECT COUNT(*) AS "Count" FROM CDBPULSE) : RESULTSET OF Result; Output AT %M(.Licence Usage.CurrentValue) : DINT; END_VAR Output := Points.Value.Count + Pulses.Value.Count; END_PROGRAM
The output is to an internal analog point. Remember to change the Hand Control range and FullScale property as necessary so the logic doesn't attempt to write out of range values and throw an error.