How Do I Retrieve the Number of Records in a Task’s Data View? (Magic xpa 3.x)
Sometimes you may want to know the size of a database table. There are three functions to do this:
![](/PublicKnowledge/servlet/rtaImage?eid=ka2D0000000ThY6&feoid=00ND0000005rAjf&refid=0EMD0000000JHkH)
-
DbSize() returns the size of the table, in bytes.
-
DbRecs() returns the number of records in the table.
-
DbViewSize() returns the number of records in the current data view.
DbViewSize() is explained below.
DbViewSize() is used when you want to determine the number of records in the current data view. The syntax is:
DbViewSize (generation)
where:
generation is the task’s hierarchic position in the runtime task tree (0 for the current task, 1 for the parent task, and so on).
In this example,
DbViewSize(0)
returns 12, the total number of records in the table. This is because, although there are 33 records in the table, the user has used a Range to show only the records beginning with the letter ‘T’.
The Online and Rich Client Samples projects (program DV01 and RDV01)