Applies To:
  • CitectSCADA 1.00 1.01 1.10 1.11 1.20 2.00 2.01

Summary:
Question: When I call the DevRecNo() function on a database that has no records, it returns 1. I would expect it to return 0. Is this correct? 

Solution:
Yes DevRecNo() function will return 1 with a database that has no records. The documentation on DevRecNo says:

Gets the current record number of a Device. If the Device is record-based, the record number ranges from 1 to the maximum size of the file. If the Device is free-format, the record number ranges from 0 to the maximum byte size -1.

Return Value The record number. If an error occurs getting the record number, -1 will be returned.

DevRecNo is returning Citect's current pointer into the database. When a database has no records, Citect will be pointing to the first record. If you want to find the number of records in a database, use DevSize(). DevSize will return the number of records in the database and will return 0 when a database has no records.

 

Keywords:
 

Attachments