The licensed point count is made up of the sum of the number of point objects and pulse objects. There are at least three ways to determine the point count currently being used by a server.
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 licence details are shown. This method will list the number of points currently used as well as the total number of points available in the licence.
PointCount.PNG 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
Using the SQL query format will only provide accurate results if the user you are logged in with has permissions to view all database point and pulse objects. Any object where you do not possess appropriate permissions will not be returned and so the apparent point count will be less than its actual value.
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